Repository navigation
Show the return date of a loan request, not "about a month" - #51
fabiodalez-dev wants to merge 9 commits into
Conversation
The sheet is a plain dialog instead of DatePickerDialog, which capped its height and cut the month in half: 20dp corners, a Fraunces title, confirm and cancel stacked at full width in the app's button styles. The month follows the web: a free day is a plain number, limited and unavailable days keep their tint with a faint rule of their own colour, today has an accent ring and the chosen day takes the theme's button colour. The legend uses dots. When availability cannot be loaded, the fallback Material picker takes the sheet's side padding too: on a 360dp phone its seventh column was otherwise cut in half. LoanRequestSheetUiTest covers the buttons, the pre-selected earliest day, the disabled states and the seventh column at 360dp (verified to fail without the fix). DESIGN.md documents the sheet.
The test forced a 360dp density around LoanRequestSheet, but a Dialog is a window of its own and takes the device density: on a 411dp emulator the days measured 42dp instead of 48dp, so the test only held on an emulator that was already 360dp wide. The sheet's content moves into LoanRequestSheetContent, which the Dialog wraps; the test lays it out in a 360dp Box at the device density. It fails without the bleed (24dp of a 40dp day in view) and passes with it on both a 360dp and a 411dp emulator.
The loan-request dialog said the loan would last "about 1 month" from the chosen day. The server sets the return date from the loan duration in the library's loan settings (loan_duration_days, 30 by default), on POST /reservations as on the website, so a library with a 14 or 60 day period saw a wrong promise. Pinakes #485 made the website's return picker open on that same duration; the app now names the library's standard loan period in all four languages, the way the staff new-loan form already does. The comments that described the return as +1 month say the same.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughIl calendario della disponibilità ora include la durata del prestito configurata dalla biblioteca. Il dialogo della richiesta mostra la data di restituzione prevista quando può calcolarla. Se la durata manca, mantiene il suggerimento standard. ChangesDurata del prestito nella richiesta
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
Mobile API 1.8.1 (Pinakes #485) adds loan_duration_days to GET
/catalog/books/{id}/availability: the days POST /reservations adds to the chosen start to set
the return date. The dialog now reads "Start: <date> · Return by: <date>" for the selected
day, in all four languages. A server that does not send the field keeps the wording about the
library's standard loan period.
LoanRequestReturnDateTest covers the date arithmetic, the parsing with and without the field,
and both dialog texts.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the whole PR: the loan-request dialog now shows the real return date when the server sends the loan duration, and a neutral message on older servers.
loan_duration_dayson availability:AvailabilityCalendar.loanDurationDaysis nullable, so servers older than Mobile API 1.8.1 still decode cleanly.- Return-date hint:
loanReturnDateadds the duration to the chosen start.LoanRequestSheetshowsbook_loan_period_rangewhen it gets a date and falls back to the rewordedbook_loan_period_hintwhen it doesn't. I checked this againstUserActionsController::reserve()on the server, which computesstart + {loanDays} dayswith no off-by-one and rejects durations below 1. The app's< 1 → nullguard matches that. - Copy and docs: The new and reworded strings are in all four
i18n/*.jsonfiles with no em dashes. The "+1 month" KDoc/comments now describe the configured duration. - Tests:
LoanRequestReturnDateTestcovers the arithmetic, parsing with and without the field, and both dialog texts. It includes theaddActivityIfNotPresentRuleChainit needs to pass undertestReleaseUnitTest.
claude-opus-5-5 | 𝕏
CodeRabbit's docstring check counted the test methods and the show() helper of LoanRequestReturnDateTest as undocumented (45% against the 80% threshold). Each now says what it pins down. Comments only.
There was a problem hiding this comment.
ℹ️ No functional issues in the merge. One minor doc note inline.
Reviewed changes
Since the last review (a00945f), this PR merged in #46's restyled loan sheet and added regression tests. The server-based return date survives the merge.
- Sheet split:
LoanRequestSheetnow wraps a newLoanRequestSheetContentin theDialog. That lets tests lay it out at a fixed width. The pre-existingCalendarLayoutTeststill findsloan-dialog, which is now on theBoxaround the sheet. - Buttons: the old
TextButtonrow is replaced by a stackedPrimaryButton/SecondaryButton. Confirm stays disabled until a day is picked and while the request is sent, becauseloading = submittingalso disables the button. - Merged hint: the return-date hint is unchanged from the reviewed version. It shows
book_loan_period_rangewhen the server sendsloan_duration_daysand the rewordedbook_loan_period_hintwhen it doesn't. - Calendar styling: in
LoanCalendar.kt, free days are no longer tinted. Partial and full days get a ring mixed from their own text colour, and the selected day uses the theme'sbutton/buttonText. The legend now uses dots. - Tests: added
LoanCalendarRegressionTest(15 Robolectric tests, with theaddActivityIfNotPresentRuleChainneeded under release) andLoanRequestSheetUiTest(4 device tests). I checked the edge cases. The past-day test still works on the 1st of a month because the grid opens on theearliestAvailablemonth.
claude-opus-5-5 | 𝕏
The merge of main had changed the historical 1.6.2 line and its repeat to 26.
0a7c344 to
5ccd695
Compare

Android counterpart of fabiodalez-dev/Pinakes#485, which now also exposes the loan duration to the app (Mobile API 1.8.1).
What changes
Under the calendar, the loan-request dialog said the loan would last "about 1 month" from the chosen day. The server sets the return date from the loan duration in the library's loan settings (
loan_duration_days, 30 by default). It does this onPOST /reservations(UserActionsController::loan()/reserve()), the same way the website does. So a library with a 14- or 60-day loan period saw a wrong promise.GET /catalog/books/{id}/availabilityreturnsloan_duration_days.AvailabilityCalendarreads it, and the dialog shows "Start: · Return by: " for the selected day (it/en/fr/de, new keybook_loan_period_range).book_loan_period_hintnow refers to the library's standard loan period instead of "about 1 month". The wording matchesstaff_loan_dates_hint.LoanRequestReturnDateTest(Robolectric) covers the date arithmetic, parsing with and without the field, and both dialog texts.The app only sends
desired_date, so the web bug fixed in #485 (an untouched request became a one-day loan) never affected it.Other PRs reviewed, nothing to port
.htaccessheal and the plugin-hook fix on the server. The app gets digital files through the API./i18n/{locale}.jsscript of the web layouts. The app doesn't use them.Testing
i18n/*.jsonfiles parse as valid JSON and have the same keys.Summary by CodeRabbit
Nuove funzionalità
Miglioramenti
Test
Calendar conflict resolution and verification
Merged PR #46's updated calendar so the styled sheet and the configured return-date hint coexist. The return date uses this PR's newer server-provided
loan_duration_days; the shared fallback grid, locale handling and responsive layout from current main are preserved. Merge #46 before this PR.All four open Android PRs combined pass 411 debug and 411 release unit tests, with no failures or skips. This includes the 15 new calendar regression tests and the existing return-date tests.
compileDebugAndroidTestKotlinalso passes; no device execution was performed during this review.