Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
dd89905b29
commit
e514f60ded
@ -82,7 +82,7 @@ final class Ritual {
|
||||
var defaultDurationDays: Int = 28
|
||||
|
||||
// Scheduling
|
||||
var timeOfDay: TimeOfDay = .anytime
|
||||
var timeOfDay: TimeOfDay = TimeOfDay.anytime
|
||||
|
||||
// Organization
|
||||
var iconName: String = "sparkles"
|
||||
|
||||
@ -132,7 +132,7 @@ struct HistoryView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
if hasMoreHistory || showingExpandedHistory {
|
||||
if hasMoreHistory || monthsToShow > baseMonthsToShow {
|
||||
Button {
|
||||
withAnimation(.easeInOut(duration: Design.Animation.standard)) {
|
||||
if monthsToShow > baseMonthsToShow {
|
||||
|
||||
@ -226,8 +226,9 @@ struct RitualDetailView: View {
|
||||
}
|
||||
|
||||
if let lastArc = ritual.latestArc {
|
||||
let totalCheckIns = lastArc.habits.reduce(0) { $0 + $1.completedDayIDs.count }
|
||||
let possibleCheckIns = lastArc.habits.count * lastArc.durationDays
|
||||
let habits = lastArc.habits ?? []
|
||||
let totalCheckIns = habits.reduce(0) { $0 + $1.completedDayIDs.count }
|
||||
let possibleCheckIns = habits.count * lastArc.durationDays
|
||||
let completionRate = possibleCheckIns > 0 ? Int(Double(totalCheckIns) / Double(possibleCheckIns) * 100) : 0
|
||||
|
||||
Text(String(localized: "Last arc completed with \(completionRate)% habit completion over \(lastArc.durationDays) days."))
|
||||
|
||||
@ -9,6 +9,7 @@ struct RitualsView: View {
|
||||
@State private var showingCreateRitual = false
|
||||
@State private var ritualToDelete: Ritual?
|
||||
@State private var ritualToRestart: Ritual?
|
||||
@State private var refreshToken = UUID()
|
||||
|
||||
enum RitualsTab: String, CaseIterable {
|
||||
case current
|
||||
@ -41,6 +42,7 @@ struct RitualsView: View {
|
||||
pastRitualsContent
|
||||
}
|
||||
}
|
||||
.id(refreshToken)
|
||||
.padding(Design.Spacing.large)
|
||||
}
|
||||
.background(LinearGradient(
|
||||
@ -108,6 +110,9 @@ struct RitualsView: View {
|
||||
} message: {
|
||||
Text(String(localized: "This will start a new arc for this ritual with the same habits. You can modify habits after starting."))
|
||||
}
|
||||
.onChange(of: store.rituals) { _, _ in
|
||||
refreshToken = UUID()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Current Tab Content
|
||||
|
||||
Loading…
Reference in New Issue
Block a user