Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/teacher #3

Merged
merged 38 commits into from
Aug 16, 2024
Merged

Feat/teacher #3

merged 38 commits into from
Aug 16, 2024

Conversation

Ayanami1314
Copy link
Contributor

feat: teacher and trainingplan.
done:

  • basic function related to teacher and trainingplan except for rating (po, dto, domain, repository, handler, ...)
  • the v1.0 of script to download and merge teacher and trainingplan data (utils/selenium-get and cmd/load)
  • basic test

todo:

  • rating (wait for the imporvement of framework and the impl of user module)
  • data validation and more test
  • impl of more api (need an api documention from frontend)

Risc-lt and others added 29 commits July 13, 2024 00:08
Use selenium(chrome) to pass jaccount's Oauth and should input the validation code by hand.
…file.py.

Usage: python teacher-profile.py -n=<jaccount> -p=<password> --limit=5000
@Ayanami1314 Ayanami1314 requested a review from dujiajun August 9, 2024 16:36
handler/teacher.go Show resolved Hide resolved
handler/teacher.go Show resolved Hide resolved
handler/trainingplan.go Outdated Show resolved Hide resolved
handler/trainingplan.go Outdated Show resolved Hide resolved
handler/trainingplan.go Outdated Show resolved Hide resolved
model/po/course.go Outdated Show resolved Hide resolved
model/po/teacher.go Outdated Show resolved Hide resolved
repository/trainingplan.go Outdated Show resolved Hide resolved
util/selenium-get/load2db.go Outdated Show resolved Hide resolved
util/selenium-get/teacher-profile.py Outdated Show resolved Hide resolved
@Ayanami1314
Copy link
Contributor Author

我这里修改了一遍,麻烦ddl看看这个最新的commit 还有什么问题吗

.gitignore Outdated Show resolved Hide resolved
model/converter/course.go Outdated Show resolved Hide resolved
model/converter/course.go Outdated Show resolved Hide resolved
model/domain/teacher.go Outdated Show resolved Hide resolved
model/dto/teacher.go Outdated Show resolved Hide resolved
model/dto/teacher.go Outdated Show resolved Hide resolved
repository/course.go Outdated Show resolved Hide resolved
util/selenium-get/load2db.go Outdated Show resolved Hide resolved
Comment on lines 65 to 86
func Lines2TrainingPlan(lines []string) LoadedTrainingPlan {
plan := LoadedTrainingPlan{
Courses: make([]LoadedCourse, 0),
}
// e.g 13050243,14761201813050243,视觉传达设计,13050243,4,28.5,艺术学,设计学院,本科,2018
metaInfo := strings.Split(lines[0], ",")
if len(metaInfo) != 10 {
panic("Invalid line2trainingplan: " + lines[0])
}
plan.Name = metaInfo[2]
plan.Code = metaInfo[0]
plan.TotalYear, _ = strconv.Atoi(metaInfo[4])
plan.MinCredits, _ = strconv.ParseFloat(metaInfo[5], 64)
plan.MajorClass = metaInfo[6]
plan.Department = metaInfo[7]
plan.Degree = metaInfo[8]
plan.EntryYear, _ = strconv.Atoi(metaInfo[9])
for _, line := range lines[1:] {
plan.Courses = append(plan.Courses, Line2Course(line))
}
return plan
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种最好是加个单测,不然以后没法维护

Comment on lines 7 to 12
func TestLoadTrainingPlan2DB(t *testing.T){
LoadTrainingPlan2DB("./data/trainingPlan.txt", nil)
}
func TestLoadTeacherProfile2DB(t *testing.T){
LoadTeacherProfile2DB("./data/teachers.json", nil)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有单测的话,单测的数据也要放进 git 里,不然ci过不了

@dujiajun
Copy link
Contributor

重新批注了,rebase main,然后跑一下 ci

- python script optimization
- refactor some structure
- add more tests
@Ayanami1314
Copy link
Contributor Author

我感觉我们这个分支中间节点和main上各写各的,rebase不太明白
还有就是问一下ddl, ci里面test中依赖已有数据库的测试怎么办,全部加上load数据进内存db的前置吗

@dujiajun
Copy link
Contributor

ci 肯定是要在测试环节导入数据,要么你就不要这部分测试。

@dujiajun
Copy link
Contributor

你这个 rebase 记录有点奇怪啊,我来重新操作一遍吧

# Conflicts:
#	cmd/migrate/migrate.go
#	handler/auth.go
#	repository/course.go
#	repository/teacher.go
@Risc-lt
Copy link
Contributor

Risc-lt commented Aug 15, 2024

那我先把CI里面的测试从仓库里转到本地, 到时候如果还需要就用github action CI的Secret存数据库密码再测试

@Risc-lt
Copy link
Contributor

Risc-lt commented Aug 15, 2024

CI可以通过了, 麻烦ddl看一下还有什么问题吗?

@dujiajun dujiajun merged commit ddac0e0 into main Aug 16, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants