From bffab29c777c0813ee284328f6f5caa9679cbc2b Mon Sep 17 00:00:00 2001 From: far-galaxy Date: Fri, 4 Aug 2023 15:07:02 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE:=20=D0=BF=D0=BE=D1=82=D0=B5=D1=80=D1=8F?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=8C=20=D0=BF=D0=BE=D0=B4=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=BF=D0=BF=D0=B0=20=D0=B2=20=D0=BE=D0=BA=D0=BD=D0=B5=20=D0=94?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE:=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=D0=B4?= =?UTF-8?q?=D0=BD=D0=B5=D0=B9=20=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D0=B8=20?= =?UTF-8?q?=D1=81=D0=B5=D0=BC=D0=B5=D1=81=D1=82=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/ssau_parser/parser.go | 2 ++ modules/tg/shedule.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) 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)