-
Notifications
You must be signed in to change notification settings - Fork 27
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
[NUOPEN-215][Shared dev] Show duration in days for Daily Rate Instruments #5031
Conversation
b2f3b08
to
b666cba
Compare
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.
Good job! I left a couple of optional comments
app/support/price_displayment.rb
Outdated
@@ -94,6 +94,9 @@ def build_quantity_presenter | |||
else | |||
quantity | |||
end | |||
|
|||
quantity_to_display /= (24 * 60) if product.is_a?(Instrument) && product.daily_booking? |
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.
Nit: I feel the logic of this method can be separated but is nothing critical.
@@ -91,6 +91,16 @@ def actual_duration_mins(actual_end_fallback: nil) | |||
end | |||
end | |||
|
|||
def actual_duration_days(actual_end_fallback: nil) |
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.
NIT: I'm not big fan of elsifs, but I'm ok with whatever way you feel is more legible.
def actual_duration_days(actual_end_fallback: nil)
return @actual_duration_days.to_i if @actual_duration_days
return TimeRange.new(actual_start_at, actual_end_at || actual_end_fallback).duration_days if actual_start_at
0
end
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 replicated the logic for actual_duration_mins
@@ -29,9 +29,19 @@ | |||
%td.order_date | |||
= od.ordered_at&.strftime("%m/%d/%Y") | |||
|
|||
%td.currency.timeinput= od.reservation.try(:duration_mins) | |||
- daily_booking_product = od.product.is_a?(Instrument) && od.product.daily_booking? |
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 check is repeated a couple of times, and I feel it might be used again in the future. Should we add it as a method in the product model?
Release Notes
Screenshot
Order receipt
Order view