Merge pull request #12 from Jannover5000r/feature-newDayUpdate
added a new if clause to check if the time is past or before 3am before sending the class update message
This commit is contained in:
commit
bf0b89e024
1 changed files with 5 additions and 0 deletions
5
main.go
5
main.go
|
|
@ -209,6 +209,8 @@ func scheduleTimetableUpdate() {
|
||||||
|
|
||||||
// Get current date to filter out new day changes
|
// Get current date to filter out new day changes
|
||||||
today := time.Now().Format("02-01-2006")
|
today := time.Now().Format("02-01-2006")
|
||||||
|
// Get current time to filter any changes to Timetable before 3am so the new day changes stop
|
||||||
|
now := time.Now()
|
||||||
|
|
||||||
for _, e := range currentEntries {
|
for _, e := range currentEntries {
|
||||||
key := lessonKey(e)
|
key := lessonKey(e)
|
||||||
|
|
@ -227,6 +229,9 @@ func scheduleTimetableUpdate() {
|
||||||
if curr.Date != today {
|
if curr.Date != today {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if now.Hour() < 3 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if prev, exists := prevMap[key]; exists {
|
if prev, exists := prevMap[key]; exists {
|
||||||
// Existing lesson — check for changes
|
// Existing lesson — check for changes
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue