fix(progress sync): take into consideration timezone offsets - #225
Conversation
OGKevin
left a comment
There was a problem hiding this comment.
Looks generally good, thanks.
Some minor ✨ change requests.
ffffc8a to
afecc25
Compare
|
Hi, I have amended some changes that (imo) resolve some of the comments. I marked the comments as resolved even though I have replied to all of them. Also I have explained the two questions related to Feel free to reply to my comments, request new changes, ask me to add documentation or anything you consider necessary. Thank you. |
- Convert UTC to local time before obtaining timestamps. - Use existing timestamps for synchronization.
From now on, in Koreader, bookmarks will be written when you pull from Kobo.
adds test for KoboStateReader and KoboStateWriter to assert that the timezones are managed correctly when working with timestamps.
refactors ReadHistory mock to be able to call addItem function.
afecc25 to
e43e9f4
Compare
|
Hi, I have updated the |
|
@cursor review |
Bugbot couldn't run — GitHub account mismatchThe GitHub account linked to your Cursor account does not match the PR author. Please ensure you're using the correct GitHub account, or run Bugbot from a team that covers this repository. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📜 Recent review details🔇 Additional comments (9)
WalkthroughThe change adds timezone-aware Kobo timestamp parsing and UTC timestamp serialization. Reading-state PUSH now uses the KOReader timestamp selected for synchronization. PULL updates matching ReadHistory entries by exact path or virtual book ID. Shared ReadHistory and SQLite mock helpers support the new tests. The test suite covers timestamp formats, offset conversion, duplicate removal, virtual paths, and missing document paths. Sequence Diagram(s)sequenceDiagram
participant KoboStateReader
participant ReadingStateSync
participant ReadHistory
participant KoboStateWriter
KoboStateReader->>ReadingStateSync: provide parsed Kobo timestamp
ReadingStateSync->>ReadHistory: persist timestamp during PULL
ReadHistory-->>ReadingStateSync: update matching entry
ReadingStateSync->>KoboStateWriter: serialize selected timestamp during PUSH
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #204
Summary
The differences between KOReader local time and Kobo UTC time wasn't taken into account.
This PR fixes it by switching to local time always before converting a time string into a timestamp.
Also fixes the Kobo time not being synchronised to KOReader
ReadHistory.Test Plan
spec/reading_state_sync_spec.luaasserting that:ReadHistoryis correctly modified after PULL synchronisation.spec/kobo_state_reader_spec.luaasserting that:readTimestampreturns the expected output.spec/kobo_state_writer_spec.luaasserting that:entry.timeafter write is in the expected format.ReadHistoryis written and books are ordered correctly after sync.