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

Add weekday pricing #1942

Merged
merged 17 commits into from
Jan 18, 2024
Merged

Add weekday pricing #1942

merged 17 commits into from
Jan 18, 2024

Conversation

MagnusHafstad
Copy link
Contributor

@MagnusHafstad MagnusHafstad commented Dec 25, 2023

This pull request implements the requested changes to cabin pricing.

  • Prices can be different for weekdays and non week days

Copy link

vercel bot commented Dec 25, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
indok-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2024 3:35pm

Copy link

codecov bot commented Dec 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9ffc050) 83.09% compared to head (6f4888b) 83.21%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1942      +/-   ##
==========================================
+ Coverage   83.09%   83.21%   +0.11%     
==========================================
  Files         100      100              
  Lines        3526     3544      +18     
==========================================
+ Hits         2930     2949      +19     
+ Misses        596      595       -1     
Flag Coverage Δ
apitests 83.21% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cypress bot commented Dec 25, 2023

Passing run #3053 ↗︎

0 2 0 0 Flakiness 0

Details:

Merge 6f4888b into 4a00ab7...
Project: Indøk Web Commit: 1fd9a00be9 ℹ️
Status: Passed Duration: 01:29 💡
Started: Jan 18, 2024 3:45 PM Ended: Jan 18, 2024 3:46 PM

Review all test suite changes for PR #1942 ↗︎

Copy link
Contributor

@torgeirlysen torgeirlysen left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@larwaa larwaa left a comment

Choose a reason for hiding this comment

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

Admins can change prices at frontend/src/pages/cabins/admin/index.tsx, should also be updated so that they may change the prices for weekends. Minor comments otherwise

Comment on lines +16 to +29
let currentDate = dayjs(startDate);
const finalDate = dayjs(endDate);
let weekdayNights = 0;
let weekendNights = 0;
let totalPrice = 0;
while (currentDate.isBefore(finalDate, "day")) {
// Last day has no night.
if (currentDate.day() === 5 || currentDate.day() === 6) {
// 5 = Friday to sat, 6 = Saturday to sunday
weekendNights++;
} else {
weekdayNights++;
}
currentDate = currentDate.add(1, "day");
Copy link
Member

Choose a reason for hiding this comment

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

I'm slightly concerned that we have to duplicate the backend logic here. I suggest that we instead add a price-query or something similar and rely on the backend logic to calculate the price. That way, we won't accidentally end up with different prices.

Co-authored-by: Lars Waage <46653859+larwaa@users.noreply.github.com>
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
No data about Coverage
0.6% Duplication on New Code

See analysis details on SonarCloud

@MagnusHafstad MagnusHafstad merged commit 11f9aae into main Jan 18, 2024
21 checks passed
@MagnusHafstad MagnusHafstad deleted the UpdateCabinPricing branch January 18, 2024 15:46
Copy link

cypress bot commented Jan 18, 2024

Passing run #3054 ↗︎

0 2 0 0 Flakiness 0

Details:

Add weekday pricing (#1942)
Project: Indøk Web Commit: 11f9aae3e2
Status: Passed Duration: 01:45 💡
Started: Jan 18, 2024 4:06 PM Ended: Jan 18, 2024 4:08 PM

Review all test suite changes for PR #1942 ↗︎

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.

4 participants