-
Notifications
You must be signed in to change notification settings - Fork 54
[#89168592] create a Proposal model #127
Conversation
Conflicts: spec/controllers/communicarts_controller_spec.rb
@@ -0,0 +1,13 @@ | |||
class Proposal < ActiveRecord::Base | |||
has_one :cart |
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.
Is there an equivalent that'd allow zero or one?
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.
Yep, has_one
does that, though probably worth noting that it won't always be present in an inline comment. Good call!
Had a couple train rides worth of downtime – updated! |
Seems like a good step towards your goal. Let me know if I can help integrating this with the workflow piece. |
|
||
dir.up do | ||
Cart.find_each do |cart| | ||
cart.create_proposal!( |
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.
Note that it's keeping the same id
on the carts, so none of the other references need to change.
Phew, ok, updated. Feels like this was a lot of work for what it was, but I am still fairly confident about the direction of having a Proposal model and then distinct models for each use case. Someone mind taking another look-see? |
👍 from me -- I'd like to see this merged soon so it doesn't drift too far from master. I don't feel confident enough to merge myself, though. @phirefly - when you get a chance, review and merge? |
We'll probably need a backfill script. Any in the works? |
t.string :flow | ||
t.timestamps | ||
end | ||
add_reference :carts, :proposal |
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.
Will NCR be of type Cart? Would it be worthwhile to name that appropriately at this point? I'm also happy with capturing that in a separate story.
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.
For the moment, yes. My plan was to deal with splitting the Cart into use-case-specific models separately.
Updated! Not sure if I succeeded in simplifying anything though 😕 To minimize the number of changes, I left all the state-related calls to the Cart ( |
[#89168592] create a Proposal model
I have been thinking about how to generalize the app, and short of actually splitting the application into multiple pieces, this PR splits a Proposal model out from Cart. The medium-term goal is to separate any GSA Advantage-specific logic from that dealing with the overall workflow and approvals. After this, I plan to create a new API for Proposals (not Carts), which can be used by Navigator, WHSC, etc.