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

Fix Promotions#index view when a promotion has expires_at set #302

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

tomdonarski
Copy link
Contributor

What?

Fix Promotions#index view when a promotion has expires_at set.
https://upsidelab.atlassian.net/browse/SP-178

Why?

Promotion#index view breaks due to an ArgumentError:
(wrong number of arguments (given 1, expected 0) (ArgumentError))

How?

Deletion of unnecessary conversion to String (along with faulty argument passing).

@tomdonarski tomdonarski force-pushed the fix/promotion_expires_at_in_admin_panel branch from 8219343 to 9dac555 Compare January 8, 2024 20:00
@tomdonarski tomdonarski force-pushed the fix/promotion_expires_at_in_admin_panel branch from 9dac555 to 6681fad Compare January 9, 2024 07:57
@@ -64,7 +64,7 @@
<td><%= promotion.description %></td>
<td><%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %></td>
<td><%= Spree.t(:current_promotion_usage, count: promotion.credits_count) %></td>
<td><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the format of the date, which I don't think is intended.
The issue is caused by Rails 7.1 having removed to_s in favor of to_fs. Since we'd like to support Rails 6.1+, I think it would be best to use strftime instead (just like some other places in the codebase do)

@rafalcymerys rafalcymerys merged commit e1b847f into main Jan 16, 2024
9 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/promotion_expires_at_in_admin_panel branch January 16, 2024 09:57
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