Исправлено: потерялась подгруппа в окне
Добавлено: автоопределение последней недели семестра
This commit is contained in:
parent
eef523fe04
commit
bffab29c77
|
@ -123,8 +123,10 @@ func (sh *WeekShedule) Parse(p Page, uncover bool) error {
|
||||||
}
|
}
|
||||||
if p.IsGroup {
|
if p.IsGroup {
|
||||||
window.GroupId = []int64{p.ID}
|
window.GroupId = []int64{p.ID}
|
||||||
|
window.SubGroup = []int{0}
|
||||||
} else {
|
} else {
|
||||||
window.TeacherId = []int64{p.ID}
|
window.TeacherId = []int64{p.ID}
|
||||||
|
window.SubGroup = []int{0}
|
||||||
}
|
}
|
||||||
shedule[y+1][x].Lessons = []Lesson{window}
|
shedule[y+1][x].Lessons = []Lesson{window}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,11 +136,13 @@ func (bot *Bot) LoadShedule(shedule ssau_parser.WeekShedule) error {
|
||||||
SheduleId: shedule.SheduleId,
|
SheduleId: shedule.SheduleId,
|
||||||
IsGroup: shedule.IsGroup,
|
IsGroup: shedule.IsGroup,
|
||||||
}
|
}
|
||||||
// TODO: вынести количество недель в переменную, либо автоматически определять конец
|
|
||||||
for week := 1; week < 21; week++ {
|
for week := 1; week < 21; week++ {
|
||||||
sh.Week = week
|
sh.Week = week
|
||||||
err := sh.DownloadById(true)
|
err := sh.DownloadById(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "404") {
|
||||||
|
break
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, _, err = ssau_parser.UpdateSchedule(bot.DB, sh)
|
_, _, err = ssau_parser.UpdateSchedule(bot.DB, sh)
|
||||||
|
|
Reference in New Issue