diff --git a/modules/ssau_parser/parser.go b/modules/ssau_parser/parser.go index c7d274b..6342c7e 100644 --- a/modules/ssau_parser/parser.go +++ b/modules/ssau_parser/parser.go @@ -123,8 +123,10 @@ func (sh *WeekShedule) Parse(p Page, uncover bool) error { } if p.IsGroup { window.GroupId = []int64{p.ID} + window.SubGroup = []int{0} } else { window.TeacherId = []int64{p.ID} + window.SubGroup = []int{0} } shedule[y+1][x].Lessons = []Lesson{window} } diff --git a/modules/tg/shedule.go b/modules/tg/shedule.go index 5f2f652..2f0ed60 100644 --- a/modules/tg/shedule.go +++ b/modules/tg/shedule.go @@ -136,11 +136,13 @@ func (bot *Bot) LoadShedule(shedule ssau_parser.WeekShedule) error { SheduleId: shedule.SheduleId, IsGroup: shedule.IsGroup, } - // TODO: вынести количество недель в переменную, либо автоматически определять конец for week := 1; week < 21; week++ { sh.Week = week err := sh.DownloadById(true) if err != nil { + if strings.Contains(err.Error(), "404") { + break + } return err } _, _, err = ssau_parser.UpdateSchedule(bot.DB, sh)