diff --git a/internal/config/daily_questions.go b/internal/config/daily_questions.go index 14e4fa3..8ad9d1a 100644 --- a/internal/config/daily_questions.go +++ b/internal/config/daily_questions.go @@ -169,6 +169,20 @@ func (q *DailyQuestions) SetDeadline(nullifier string, id int, duration time.Dur return true } +func (q *DailyQuestions) ZeroDeadline(nullifier string) *Deadline { + q.mu.Lock() + defer q.mu.Unlock() + + deadline, ok := q.deadlines[nullifier] + if !ok { + return nil + } + deadline.At = time.Unix(0, 0) + q.deadlines[nullifier] = deadline + + return &deadline +} + func (q *DailyQuestions) ClearDeadlines() map[int]int { q.mu.Lock() defer q.mu.Unlock() diff --git a/internal/service/handlers/daily_question_check.go b/internal/service/handlers/daily_question_check.go index cd700d3..ca08b26 100644 --- a/internal/service/handlers/daily_question_check.go +++ b/internal/service/handlers/daily_question_check.go @@ -121,6 +121,8 @@ func CheckDailyQuestion(w http.ResponseWriter, r *http.Request) { return } + dq.ZeroDeadline(nullifier) + ape.Render(w, newDailyAnswer(question)) }