Skip to content
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

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

LeticiaErrandonea
Copy link
Collaborator

@LeticiaErrandonea LeticiaErrandonea commented Feb 18, 2025

Release Notes

  • Show duration in days for Daily Rate Instruments

Screenshot

Order receipt

image

Order view

image

@LeticiaErrandonea LeticiaErrandonea force-pushed the nuopen-215-daily_rate_in_days branch from b2f3b08 to b666cba Compare February 18, 2025 21:34
Copy link
Collaborator

@diebas diebas left a 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

@@ -94,6 +94,9 @@ def build_quantity_presenter
else
quantity
end

quantity_to_display /= (24 * 60) if product.is_a?(Instrument) && product.daily_booking?
Copy link
Collaborator

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)
Copy link
Collaborator

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

Copy link
Collaborator Author

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?
Copy link
Collaborator

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?

@LeticiaErrandonea LeticiaErrandonea merged commit eb2fc37 into master Feb 19, 2025
3 checks passed
@LeticiaErrandonea LeticiaErrandonea deleted the nuopen-215-daily_rate_in_days branch February 19, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants