New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package management by context and handling of repackaging process #1729
Conversation
nuclearkatie
commented
Apr 11, 2024
•
edited
edited
- Fix unpackaged (default) package type. Closes Unpackaged id gets created as id 2, id 1 is not actually tied to a package #1730
- Ensure that creating new packages is done through the context (context::AddPackage), which calls Package::Create. Closes New package types can't just be created, they must also be given to the context to manage #1731
- Package-filling process managed by resource, not by package. Closes Resolve templating for Pacakge functions #1714
Downstream Build Status Report - 7092890 - 2024-04-30 14:57:21 -0600Build
|
Pull Request Test Coverage Report for Build 8901490530Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With apologies to another flip-flop (let's discuss) here are some otherwise minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the initialization of the unpackaged package in the context has gotten more complicated than it needs to... unless I'm forgetting something about how it all works.
src/material.cc
Outdated
|
||
while (quantity() > pkg->fill_min()) { | ||
double pkg_fill = std::min(quantity(), fill_mass); | ||
m_pkgd = boost::dynamic_pointer_cast<Material>(ExtractRes(pkg_fill)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this is the only line that really forces this method to be replicated 3 times... I'll have to dust off my C++ polymorphism to see if there's a better way...
try singleton pattern for unpackaged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One error here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we've resolved the main design questions, a few final cleanup changes.
Co-authored-by: Paul Wilson <paul.wilson@wisc.edu> Signed-off-by: Katie Mummah <radioactivekate@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments have the fix for the current issue, but not sure what it will mean for nuances when we call these methods.
Co-authored-by: Paul Wilson <paul.wilson@wisc.edu> Signed-off-by: Katie Mummah <radioactivekate@gmail.com>
promote Package to parent class with templating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest a couple of additional tests.
// all packaged | ||
std::vector<Product::Ptr> p1_pkgd = p1->Package<Product>(pkg); | ||
EXPECT_EQ(p1->quantity(), 0); | ||
EXPECT_EQ(p1_pkgd[0]->package_id(), pkg_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also check the number of packages? If I read this right, p1_pkgd
should be length one: all of its 3 units of quantity in a single package.
We could also package p2
and its 7 units would end up in two packages of size 5 and 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll never guess what was sitting forgotten in my stashes.... though I didn't I have the two packages case