-
Notifications
You must be signed in to change notification settings - Fork 57
Conversation
@@ -59,6 +59,7 @@ | |||
<%= f.input :enable_renewals, label: 'Enable renewals', hint: 'Allow users to renew reservations.' %> | |||
</fieldset> | |||
|
|||
<<<<<<< HEAD |
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.
this looks leftover from a merge conflict :-P
This looks really nice. I left a bunch of inline comments, the biggest of which is the refactoring of the two reservations controller methods (
Not sure what that's all about, see if it's something we need to deal with. Great work! |
Also note that the query for the |
I fixed most of the issues you pointed out in the comments. I've refactored the checkin/checkout email methods, but it's failing quite a few tests so I haven't committed it yet. The parsing issues in the email bodies also have yet to be corrected. |
The tests no longer fail because of the refactored |
also--it seems like the |
@equipment_list@\n\n\ | ||
If you fail to return your equipment on time you will be subject to a late fee of @late_fee@ per day. If you have lost the item you may additioally have to pay a replacement fee of Replacement_fee@.\n\ | ||
If you fail to return your equipment on time you will be subject to a late fee of @late_fee@ per day. If you have lost the item you may additionally have to pay a replacement fee of @replacement_fee@.\n\ |
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.
ha nice catch :-)
Also, the checkout receipt fails when the reservation is due back today or is overdue but hasn't yet been returned (since the status is now "due today" or "overdue"). We might need to pass a Note also that my comment above also applies to the logic determining whether or not to display the "send receipt" button. |
def checkin_email | ||
if UserMailer.checkin_receipt(@reservation).deliver | ||
def send_receipt | ||
if UserMailer.reservation_status_update(@reservation).deliver | ||
redirect_to :back |
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.
This is no good since if we call this from the receipt
view that is rendered by the checkout
or checkin
methods, then it tries to run checkout
or checkin
again resulting in a RecordNotFound
exception. Why don't we redirect to the reservation in both cases?
Nice job dealing with round 1, I left a few more inline comments and found a couple more issues while manually testing out this functionality (see above). Once those are addressed you should also play around with this branch and make sure everything works as expected (all buttons / links and all rake tasks). Hopefully we can get this done in tomorrow's meeting! |
okay, everything is fixed and working locally, about to force push onto this branch to fix the git issues, let's hope it works |
3058f59
to
b88351b
Compare
I think this is all set? |
Thanks, I'll have to review this tomorrow but hopefully we'll be able to get it in as well. What was your ultimate solution to fixing all the Git weirdness? |
I made a new branch locally, merged in 938, cherrypicked from 665, then force pushed to this branch haha |
@status = 'due today' | ||
end | ||
|
||
if receipt && (@status == 'due today' || @status == 'overdue') |
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.
We should probably also check to make sure it's been checked out if the receipt parameter is true. An alternative way to structure this would be to write a second method send_receipt
that runs that validation (e.g. return unless reservation.checked_out
) and then calls reservation_status_update(reservation, true)
.
On that note, what happens if it's returned overdue
? As written, it's not called a "receipt", but we can fix that in the view below (I'll leave a comment there).
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.
perhaps the name "receipt" for the variable is misleading--I only wanted to use it to force sending a checkout receipt if requested from the reservations controller; other cases should work without the additional parameter
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.
No I understand that, what I'm saying is that someone could end up issuing a request to the get_receipt
route, passing a reservation that isn't yet checked out and therefore it should fail. Unless I missed it, we're not currently checking for that anywhere (so if you end up calling reservation_status_update(res, true)
and res.checked_out == nil
the e-mail view will probably fail since it will try to call strftime
on nil
). Does that make more sense?
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.
right yeah, that was in response to returned overdue
not being called a receipt. I think we're on the same page
Once we've dealt with validating the receipt requests, I think this should be good to go (whew). |
once travis finishes this should be good! |
end | ||
|
||
if checkout_receipt && (@status == 'due today' || @status == 'overdue') && | ||
@reservation.checked_out |
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.
Hmm, I almost feel like we should return
here if it's not checked out. As I see it:
- If
checkout_receipt
(orreceipt
, I actually prefer the latter since we made one controller method for both cases)- If checked out and status weirdness then fix status
- If checked out and status is checked out then do nothing
- If not checked out, don't send the e-mail
- If checked in, do nothing
Does that make sense?
Oh no! What's the merge conflict? In either case, you can just squash rebase, then rebase onto master to resolve it. Good work! |
94dfc8d
to
9304e63
Compare
generalized email methods spec for overhauled mailer replaced email methods everywhere don't send fine emails if there's no fine upcoming check out email added to unified email method add email checkout reminders task to the heroku scheduler refactored check in / out receipt methods
9304e63
to
404634c
Compare
Resolves #665 and #938