screen-locker/stronglift_replacement/workout_app/lib/models/exercise_result.dart
Krzysztof kuhy Rudnicki 23d2173d9f Add comprehensive test suite, backup service, and linting to workout app
- Add sqflite_common_ffi + very_good_analysis; tighten analysis_options
- Add BackupService for JSON export/import of exercise state
- Add full test coverage: models, screens, services, widgets
- Add scripts/check_flutter_coverage.sh to enforce 100% line coverage
- Add docstrings to ExerciseState fields and storage service
- Minor fixes across screens, widgets, and sync/HTTP services

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuiPt6GPWkxpLbJFrnfy8U
2026-06-28 08:11:43 +02:00

39 lines
1.1 KiB
Dart

/// All set results for one exercise in a workout session.
library;
import 'package:workout_app/models/exercise.dart';
import 'package:workout_app/models/set_result.dart';
/// Aggregated results for a single exercise across all its sets in a session.
class ExerciseResult {
/// Creates a result for [exercise] with the given [sets] outcomes.
const ExerciseResult({
required this.exercise,
required this.sets,
this.warmupDone = false,
});
/// The exercise definition this result belongs to.
final Exercise exercise;
/// Results for each individual set.
final List<SetResult> sets;
/// Whether the warmup set was completed before the working sets.
final bool warmupDone;
/// True when every set was fully completed.
bool get succeeded => sets.isNotEmpty && sets.every((s) => s.succeeded);
/// Serializes this exercise result to a JSON map.
Map<String, dynamic> toJson() => {
'name': exercise.name,
'targetSets': exercise.sets,
'targetReps': exercise.reps,
'targetWeight': exercise.weight,
'warmupDone': warmupDone,
'sets': sets.map((s) => s.toJson()).toList(),
'succeeded': succeeded,
};
}