diff --git a/cmd/web/sendreminderhandler.go b/cmd/web/sendreminderhandler.go index 5b51f87..55ba159 100644 --- a/cmd/web/sendreminderhandler.go +++ b/cmd/web/sendreminderhandler.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "strings" + "time" "github.com/hculpan/areweplaying/cmd/web/templates" "github.com/hculpan/areweplaying/pkg/data" @@ -33,7 +34,19 @@ If you wish to check on the status of the game, you may do so at https://awp.cul Thank you, Your friendly "Are We Playing?" automated system`, session.Date) - comp := templates.SendReminder(to, subject, text) + now := time.Now() + sessionDate, err := time.Parse(data.DATE_FORMAT, session.Date) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + msg := "" + if now.After(sessionDate) { + msg = "Session date is in the past." + } + + comp := templates.SendReminder(to, subject, text, msg) comp.Render(context.Background(), w) } diff --git a/cmd/web/templates/header.templ b/cmd/web/templates/header.templ index a0dd768..87d0715 100644 --- a/cmd/web/templates/header.templ +++ b/cmd/web/templates/header.templ @@ -10,5 +10,6 @@ templ Header() { + } \ No newline at end of file diff --git a/cmd/web/templates/header_templ.go b/cmd/web/templates/header_templ.go index c523b38..ec8ed58 100644 --- a/cmd/web/templates/header_templ.go +++ b/cmd/web/templates/header_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.513 +// templ: version: v0.2.639 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -23,25 +23,7 @@ func Header() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("