diff --git a/Shared/ShowBasedOnVoteLogics.swift b/Shared/ShowBasedOnVoteLogics.swift index 60c838f..eeaaeb0 100644 --- a/Shared/ShowBasedOnVoteLogics.swift +++ b/Shared/ShowBasedOnVoteLogics.swift @@ -30,7 +30,7 @@ import SwiftUI */ class ShowBasedOnVoteLogics { - static private func returnCurrentVoteStatus(onboardingData: OnboardingData) -> (Bool, DayOptions) { + static private func returnCurrentVoteStatus(onboardingData: OnboardingData) -> (passedTimeToVote: Bool, inputDay: DayOptions) { let passedTimeToVote = ShowBasedOnVoteLogics.passedTodaysVotingUnlock(voteDate: onboardingData.date) let inputDay: DayOptions = onboardingData.inputDay @@ -75,9 +75,10 @@ class ShowBasedOnVoteLogics { static public func getCurrentVotingDate(onboardingData: OnboardingData) -> Date { var date: Date? + let currentVoteStatus = ShowBasedOnVoteLogics.returnCurrentVoteStatus(onboardingData: onboardingData) // note to future self, this should account for midnight until next voting unlock // the vote at 12:03 am will not be passed time, and will be for yesterday - switch ShowBasedOnVoteLogics.returnCurrentVoteStatus(onboardingData: onboardingData) { + switch (currentVoteStatus.passedTimeToVote, currentVoteStatus.inputDay) { case (false, .Today): // if we're passed time to vote and the voting type is previous - last vote should be -1 date = Calendar.current.date(byAdding: .day, value: -1, to: Date()) @@ -101,7 +102,8 @@ class ShowBasedOnVoteLogics { } static public func getVotingTitle(onboardingData: OnboardingData) -> String { - switch ShowBasedOnVoteLogics.returnCurrentVoteStatus(onboardingData: onboardingData) { + let currentVoteStatus = ShowBasedOnVoteLogics.returnCurrentVoteStatus(onboardingData: onboardingData) + switch (currentVoteStatus.passedTimeToVote, currentVoteStatus.inputDay) { case (false, .Today): return String(localized: "add_mood_header_view_title_yesterday") case (true, .Today):