Skip to content

Commit f91fb52

Browse files
committed
refactor(academic): update course hash logics
1 parent d37b1d7 commit f91fb52

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

internal/academic/service/get_scores.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (s *AcademicService) handleScoreChange(stuID string, scores []*jwch.Mark) (
167167
if scores[i].Score != oldScores[i].Score {
168168
// 尝试获取课程信息
169169
courseHash := utils.GenerateCourseHash(scores[i].Name, scores[i].Semester, scores[i].Teacher,
170-
scores[i].ElectiveType)
170+
scores[i].ElectiveType, scores[i].Classroom)
171171
existingCourse, err := s.db.Academic.GetCourseByHash(s.ctx, courseHash)
172172
if err != nil {
173173
return err

pkg/utils/jwch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func ParseJwchStuId(id string) string {
5454
}
5555

5656
// GenerateCourseHash 生成课程的唯一哈希
57-
func GenerateCourseHash(name, term, teacher, electiveType string) string {
58-
input := strings.Join([]string{name, term, teacher, electiveType}, "|")
57+
func GenerateCourseHash(name, term, teacher, electiveType, classroom string) string {
58+
input := strings.Join([]string{name, term, teacher, electiveType, classroom}, "|")
5959
return SHA256(input)
6060
}

0 commit comments

Comments
 (0)