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

Remove ProgramsView from students learning menu; Add autofail_ungraded functional and tests #800

Merged
merged 24 commits into from
Feb 1, 2024

Conversation

Dmi4er4
Copy link
Collaborator

@Dmi4er4 Dmi4er4 commented Jan 26, 2024

Checklist:

  • I have performed a self-review of my own code:
    • Good naming: make sure you would understand your code if you read it a few months from now.
    • No common performance issues (e.g. N + 1 problem)
    • Unrelated code has been removed (unused imports, print statements, unrelated template context variables, commented code, etc)
    • I have commented my code, particularly in hard-to-understand areas
  • I understand that short PRs lead to higher-quality code and faster delivery of features.
  • Linear history: my code has been rebased on the most recent commit in the master branch before opening PR
  • I have followed conventional commits specification for PR title
  • I have referenced YouTrack issue in the PR description for easy access
  • I have added tests that prove my code works

class Command(BaseCommand):
help = """
Set grade to fail for all ungraded students. Only in courses of current semester by default.
Set --prev-sem flag to apply for courses from Autumn 2020 till previous semester.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Зачем реализована такая странная логика? Почему в этом случае явно не запрашивать указание семестра?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

По аналогии с автоматическим выставлением оценок по проектам, по дефолту изменяется действующий сем. Сделано, как я понимаю, в основном в качестве защиты от дурака, чтобы невозможно было поменять наследие. Флаг придуман, чтобы можно было единократно запустить этот скрипт на проде и почистить все оценки до 2020 года. Доступа к нему нет из UI сайта.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Осень 2020 года выбран как последний важный сем. Предполагается, что не существует действующих студентов, поступивших раньше.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Если нужно запустить один раз, то это не должно потом храниться вечно в репозитории.

enrollments = enrollments.filter(grade=GradeTypes.NOT_GRADED,
course__semester=current_term,
student_profile__branch__site__domain=site)
graded = enrollments.update(grade=GradeTypes.UNSATISFACTORY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Хорошо бы записать куда-то в лог, что было изменено. Пусть даже операция без отката, но у тебя хоть какой-то будет механизм восстановления.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Логировать все измененные enrollments не вариант, поскольку писать в консоль 6000+ записей это не только долго, но и бессмысленно. Ибо неясно каким образом это хоть как-то использовать. Добавлю логирование семестра измененных отметок.

Copy link
Collaborator

Choose a reason for hiding this comment

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

логирование оно же не только в консоль, но и в файл должно быть

@@ -17,7 +17,7 @@
ProgressReportForSemesterView, ProgressReportFullView, StudentFacesView,
StudentSearchCSVView, StudentSearchView, SurveySubmissionsReportView,
SurveySubmissionsStatsView, WillGraduateStatsReportView, autograde_projects,
create_alumni_profiles
autofail_ungraded, create_alumni_profiles
Copy link
Collaborator

Choose a reason for hiding this comment

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

Стиль именования этих view отличается, стоит сделать тоже CamelCase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Это не view, поэтому и отличается. Это кастомные команды django-admin.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Тогда странно, что они таким образом смешиваются в импорте

apps/staff/views.py Show resolved Hide resolved
lk_yandexdataschool_ru/menu.py Show resolved Hide resolved
manage.py Outdated Show resolved Hide resolved
@atolstikov atolstikov merged commit 7f38836 into cscenter:master Feb 1, 2024
@Dmi4er4 Dmi4er4 deleted the dev branch February 3, 2024 09:51
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.

2 participants