Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Matching an earlier set is no longer a record
InlitX7446474df0e3
diff --git a/lib/state/stats_state.dart b/lib/state/stats_state.dartindex 9b2e426..5c3e355 100644--- a/lib/state/stats_state.dart+++ b/lib/state/stats_state.dart@@ -294,6 +294,7 @@ mixin StatsState on FitCore, ToolsState, LibraryState, SettingsState, TimelineStbool _beats(String id, LoggedSet st, _Best? best) {if (best == null || !st.counts || st.reps <= 0 && (st.sec ?? 0) <= 0 && (st.km ?? 0) <= 0) return false;+ if (_onLadder(id, st) && best.front.any((p) => p.$1 >= st.reps && p.$2 >= st.weight - 1e-9)) return false;if (_setScore(id, st) > best.score + 1e-9) return true;if (isAssisted(id) || st.weight <= 0) return false;if (st.weight > best.weight + 1e-9 || st.weight * st.reps > best.volume + 1e-9) return true;@@ -310,11 +311,11 @@ mixin StatsState on FitCore, ToolsState, LibraryState, SettingsState, TimelineSt_Best _raise(String id, LoggedSet st, _Best? best) {var front = best?.front ?? const <(int, double)>[];- if (_onLadder(id, st)) {+ if (_onLadder(id, st) && !front.any((p) => p.$1 >= st.reps && p.$2 >= st.weight - 1e-9)) {front = [for (final p in front)if (!(st.reps >= p.$1 && st.weight >= p.$2 - 1e-9)) p,- if (!front.any((p) => p.$1 >= st.reps && p.$2 >= st.weight - 1e-9)) (st.reps, st.weight),+ (st.reps, st.weight),];}return (diff --git a/test/records_test.dart b/test/records_test.dartindex bfa83f0..6b5a7b8 100644--- a/test/records_test.dart+++ b/test/records_test.dart@@ -351,6 +351,21 @@ void main() {expect(records.contains(dominated), isFalse, reason: 'menos reps con el mismo peso no es récord');});+ test('#400 repetir peso y reps no es récord aunque antes llevara RPE y ahora no', () {+ final raise = fit.matchExerciseByName('Dumbbell Lateral Raise')!.id;+ final again = LoggedSet(8, 20);+ final fewer = LoggedSet(6, 20);+ final more = LoggedSet(10, 20);+ fit.sessions.addAll([+ day(3, raise, [LoggedSet(8, 20, rpe: 10), LoggedSet(8, 20, rpe: 10)]),+ day(1, raise, [again, fewer, more]),+ ]);+ final records = fit.recordSets;+ expect(records.contains(again), isFalse, reason: 'ya había hecho 20 kg × 8');+ expect(records.contains(fewer), isFalse);+ expect(records.contains(more), isTrue, reason: '20 kg × 10 es nuevo');+ });+test('en el entreno la serie hecha que bate la marca lleva trofeo', () {final bench = fit.matchExerciseByName('Barbell Bench Press')!.id;fit.sessions.add(day(3, bench, [LoggedSet(8, 80)]));diff --git a/test/stats_realdata_test.dart b/test/stats_realdata_test.dartindex 6b048c1..b3f130d 100644--- a/test/stats_realdata_test.dart+++ b/test/stats_realdata_test.dart@@ -49,7 +49,7 @@ void main() {final end = now.subtract(Duration(days: endDaysAgo));double sum = 0;for (final s in (raw['sessions'] as List)) {- final d = DateTime.parse(s['d'] as String);+ final d = DateTime.parse(s['d'] as String).subtract(Duration(seconds: (s['dur'] as num?)?.toInt() ?? 0));if (d.isAfter(start) && !d.isAfter(end)) {for (final e in (s['ex'] as List)) {for (final st in (e['s'] as List)) {