首次远程推送
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import '../core/date_keys.dart';
|
||||
import 'app_state.dart';
|
||||
import 'growth_stage.dart';
|
||||
|
||||
class TodayProgress {
|
||||
const TodayProgress({
|
||||
@@ -10,7 +9,6 @@ class TodayProgress {
|
||||
required this.completedHabits,
|
||||
required this.totalHabits,
|
||||
required this.hasReflection,
|
||||
required this.growthStage,
|
||||
});
|
||||
|
||||
factory TodayProgress.fromState(AppState state, String dateKey) {
|
||||
@@ -23,8 +21,11 @@ class TodayProgress {
|
||||
.where((habit) => habit.completedDates.contains(dateKey))
|
||||
.length,
|
||||
totalHabits: state.habits.length,
|
||||
hasReflection: state.reflections.any((entry) => entry.dateKey == dateKey),
|
||||
growthStage: growthStageFor(state, dateKey),
|
||||
hasReflection:
|
||||
state.reflections.any((entry) => entry.dateKey == dateKey) ||
|
||||
state.progressNotes.any(
|
||||
(entry) => entry.dateKey == dateKey && entry.hasContent,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,16 +35,15 @@ class TodayProgress {
|
||||
final int completedHabits;
|
||||
final int totalHabits;
|
||||
final bool hasReflection;
|
||||
final GrowthStage growthStage;
|
||||
|
||||
bool get hasIntention => intention.isNotEmpty;
|
||||
bool get hasFocus => focusMinutes > 0;
|
||||
bool get hasHabits => completedHabits > 0;
|
||||
bool get isLoopClosed => hasIntention && hasFocus && hasReflection;
|
||||
int get completedSteps =>
|
||||
[
|
||||
hasIntention,
|
||||
hasFocus,
|
||||
hasHabits,
|
||||
hasReflection,
|
||||
].where((complete) => complete).length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user