mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-12 08:30:54 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (flutter, flutter-analyze, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,flutter-analyze) (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / lock-popup-safety (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (0) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (1) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (2) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (3) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (4) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (5) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (6) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (7) (push) Has been cancelled
Tests / web-coverage (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
Tests / flutter-coverage (push) Has been cancelled
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27 lines
1.1 KiB
Dart
27 lines
1.1 KiB
Dart
/// Whether a synced workout already covers a given day.
|
|
///
|
|
/// The home screen opens a fresh workout by itself on launch unless one
|
|
/// already counts for today -- and "counts" is wider than this phone's own
|
|
/// history: a manual workout, the PC's verified RunnerUp run, or a session
|
|
/// logged on another device all mean there is nothing left to push for.
|
|
library;
|
|
|
|
/// The `YYYY-MM-DD` key a workout record is dated with.
|
|
///
|
|
/// The PC dates every synced record by its `log.json` day key, which is a
|
|
/// local calendar day -- the same calendar [DateTime.now] reads on the phone.
|
|
String dayKey(DateTime day) =>
|
|
'${day.year.toString().padLeft(4, '0')}-'
|
|
'${day.month.toString().padLeft(2, '0')}-'
|
|
'${day.day.toString().padLeft(2, '0')}';
|
|
|
|
/// Whether any of [payloads] (merged cross-device workout records) is dated
|
|
/// [day].
|
|
///
|
|
/// A prefix match, so both a bare `2026-09-28` and a full ISO timestamp from
|
|
/// a StrongLifts session read as the same day.
|
|
bool anyWorkoutOn(Iterable<Map<String, dynamic>> payloads, DateTime day) {
|
|
final key = dayKey(day);
|
|
return payloads.any((p) => '${p['date']}'.startsWith(key));
|
|
}
|