Skip to content

Commit

Permalink
clean up and finish next schafkopf event schedule state
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernhard95 committed Oct 31, 2024
1 parent 12b669b commit 0ef817e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions infrastructure/api/vars.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "dynamodb_email_arn" {
type = "string"
type = string
}

variable "dynamodb_polls_arn" {
type = "string"
type = string
}
8 changes: 3 additions & 5 deletions schafkopf/core/dynamodb/poll_table.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from datetime import datetime
from datetime import datetime, timedelta
from typing import Optional

from pydantic import BaseModel
Expand All @@ -11,7 +11,6 @@ class PollItem(BaseModel):
running_poll_id: str
start_next_poll_date: datetime
new_poll_email_sent: datetime
event_invitation_email_sent: Optional[datetime] = None
next_schafkopf_event: Optional[datetime] = None

@staticmethod
Expand All @@ -24,15 +23,14 @@ def create_new(poll_id: str, next_poll_date: datetime) -> "PollItem":
)

def event_scheduled_update(self, event_date: datetime):
self.start_next_poll_date = event_date
self.start_next_poll_date = event_date + timedelta(days=1)
self.next_schafkopf_event = event_date
self.event_invitation_email_sent = datetime.now()

def poll_is_running(self) -> bool:
return (
self.running_poll_id and
datetime.now() < self.start_next_poll_date and
self.event_invitation_email_sent is None
self.next_schafkopf_event is None
)

def is_time_to_start_new_poll(self) -> bool:
Expand Down
10 changes: 3 additions & 7 deletions web/src/pages/SchedulingState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ const SchedulingState: React.FC = () => {
</TimelineOppositeContent>
<TimelineSeparator>
<TimelineConnector/>
<ScheduledIcon/>
<TimelineDot color={poll.next_schafkopf_event === null ? "grey": "primary"} variant="outlined">
<Timer/>
</TimelineDot>
<TimelineConnector/>
</TimelineSeparator>
<TimelineContent sx={{m: 'auto 0'}}>
Expand Down Expand Up @@ -135,12 +137,6 @@ const PendingIcon: React.FC = () => {
</TimelineDot>
}

const ScheduledIcon: React.FC = () => {
return <TimelineDot color="grey" variant="outlined">
<Timer/>
</TimelineDot>
}

const formatDatetime = (d: string) => {

return moment(d).format("dddd DD.MM.")
Expand Down

0 comments on commit 0ef817e

Please sign in to comment.