fix(statistiques): corrige dates et tri progression
Corrige le décodage des timestamps issus des customSelect (secondes vs millisecondes) et le tri des options d'exercice pour privilégier les exercices actifs avant les archivés, avec tie-breakers (ticket #82). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -1823,7 +1823,10 @@ FROM ranked
|
|||||||
LEFT JOIN exercises
|
LEFT JOIN exercises
|
||||||
ON exercises.id = ranked.source_exercise_id_snapshot
|
ON exercises.id = ranked.source_exercise_id_snapshot
|
||||||
GROUP BY ranked.exercise_key
|
GROUP BY ranked.exercise_key
|
||||||
ORDER BY last_performed_at DESC
|
ORDER BY is_archived ASC,
|
||||||
|
last_performed_at DESC,
|
||||||
|
exercise_name_snapshot COLLATE NOCASE ASC,
|
||||||
|
ranked.exercise_key ASC
|
||||||
''', variables: _projectionVariables(range)).get();
|
''', variables: _projectionVariables(range)).get();
|
||||||
return rows
|
return rows
|
||||||
.map(
|
.map(
|
||||||
@ -2745,6 +2748,9 @@ DateTime _dateTimeFromData(Map<String, dynamic> data, String key) {
|
|||||||
return value.toUtc();
|
return value.toUtc();
|
||||||
}
|
}
|
||||||
if (value is int) {
|
if (value is int) {
|
||||||
|
if (value.abs() < 100000000000) {
|
||||||
|
return DateTime.fromMillisecondsSinceEpoch(value * 1000, isUtc: true);
|
||||||
|
}
|
||||||
return DateTime.fromMillisecondsSinceEpoch(value, isUtc: true);
|
return DateTime.fromMillisecondsSinceEpoch(value, isUtc: true);
|
||||||
}
|
}
|
||||||
throw domain.DomainException('Invalid timestamp column: $key');
|
throw domain.DomainException('Invalid timestamp column: $key');
|
||||||
@ -2759,6 +2765,9 @@ DateTime? _dateTimeOrNullFromData(Map<String, dynamic> data, String key) {
|
|||||||
return value.toUtc();
|
return value.toUtc();
|
||||||
}
|
}
|
||||||
if (value is int) {
|
if (value is int) {
|
||||||
|
if (value.abs() < 100000000000) {
|
||||||
|
return DateTime.fromMillisecondsSinceEpoch(value * 1000, isUtc: true);
|
||||||
|
}
|
||||||
return DateTime.fromMillisecondsSinceEpoch(value, isUtc: true);
|
return DateTime.fromMillisecondsSinceEpoch(value, isUtc: true);
|
||||||
}
|
}
|
||||||
throw domain.DomainException('Invalid timestamp column: $key');
|
throw domain.DomainException('Invalid timestamp column: $key');
|
||||||
|
|||||||
Reference in New Issue
Block a user