Browse Source

Remove hardcoding for current week

Toni Fadjukoff 6 years ago
parent
commit
e120e26b13
1 changed files with 4 additions and 1 deletions
  1. 4 1
      bot.go

+ 4 - 1
bot.go View File

236
 		return err
236
 		return err
237
 	}
237
 	}
238
 
238
 
239
-	currentWeek := 2
239
+	_, currentWeek := time.Now().ISOWeek()
240
 	numberReg, _ := regexp.Compile("\\d+")
240
 	numberReg, _ := regexp.Compile("\\d+")
241
 	for _, section := range sections {
241
 	for _, section := range sections {
242
 		weekStr := numberReg.FindString(section.title)
242
 		weekStr := numberReg.FindString(section.title)
243
 		if weekStr != "" {
243
 		if weekStr != "" {
244
 			weekNumber, _ := strconv.Atoi(weekStr)
244
 			weekNumber, _ := strconv.Atoi(weekStr)
245
+			if weekNumber < currentWeek-1 {
246
+				continue
247
+			}
245
 			if weekNumber > currentWeek {
248
 			if weekNumber > currentWeek {
246
 				break
249
 				break
247
 			}
250
 			}