Исправлено: потерялась подгруппа в окне

Добавлено: автоопределение последней недели семестра
This commit is contained in:
far-galaxy 2023-08-04 15:07:02 +04:00
parent eef523fe04
commit bffab29c77
2 changed files with 5 additions and 1 deletions

View File

@ -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}
}

View File

@ -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)