Skip to content

Conversation

@steve1rm
Copy link
Owner

Fixes issue of not showing the sync data time after the sync has happened after a duration of time as passed since the last sync data

…ened after a duration of time as passed since the last sync data
@steve1rm steve1rm requested review from Copilot and rainxchzed July 29, 2025 14:09
@steve1rm steve1rm self-assigned this Jul 29, 2025
@steve1rm steve1rm merged commit 5926cc4 into master Jul 29, 2025
1 check passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a date/time calculation issue in the sync status display logic that was preventing the correct sync time from being shown after a certain duration had passed since the last sync.

Key changes:

  • Fixed period calculation between sync time and current time
  • Simplified datetime formatting by removing redundant padding specification
  • Corrected time comparison logic for "Just now" threshold

val period = syncDateTime.date.minus(currentDateTime.date)

if(syncDateTime.minute - currentDateTime.minute <= 5) {
if(period.inWholeMinutes<= 5) {
Copy link

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

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

Missing space before the comparison operator. Should be period.inWholeMinutes <= 5 for consistency with Kotlin style guidelines.

Suggested change
if(period.inWholeMinutes<= 5) {
if (period.inWholeMinutes <= 5) {

Copilot uses AI. Check for mistakes.
"Never synced"
}
else {
val syncDateTime = kotlin.time.Instant.fromEpochMilliseconds(this)
Copy link

Copilot AI Jul 29, 2025

Choose a reason for hiding this comment

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

The period calculation is incorrect. You're subtracting an Instant from an Instant, but syncDateTime is an Instant while you need to compare with current time. This should be val period = currentDateTime - kotlin.time.Instant.fromEpochMilliseconds(this) or convert both to the same type.

Suggested change
val syncDateTime = kotlin.time.Instant.fromEpochMilliseconds(this)
val syncDateTime = Instant.fromEpochMilliseconds(this)

Copilot uses AI. Check for mistakes.
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