Skip to content

Commit

Permalink
Add enrollemnt id to student assignments answers (#924)
Browse files Browse the repository at this point in the history
* Add id to student Assignments answers

* Test fix
  • Loading branch information
Dmi4er4 authored Dec 23, 2024
1 parent 4e9a802 commit 5d8ffb9
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 52 deletions.
2 changes: 1 addition & 1 deletion apps/admission/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2024-07-23 17:04+0000\n"
"Last-Translator: Дмитрий Чернушевич <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion apps/htmlpages/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2015-03-18 08:34+0000\n"
"Last-Translator: Jannis Leidel <[email protected]>\n"
"Language-Team: Russian (http://www.transifex.com/projects/p/django/language/"
Expand Down
2 changes: 2 additions & 0 deletions apps/learning/gradebook/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def get(self, request, *args, **kwargs):
_("Patronymic"),
_("Branch"),
_("Role"),
_("Email"),
"Тип записи",
_("CSCUser|Curriculum year"),
_("Group"),
Expand Down Expand Up @@ -275,6 +276,7 @@ def get(self, request, *args, **kwargs):
student.patronymic,
student_profile.branch.name,
student_profile.get_type_display(),
student.email,
gradebook_student.enrollment_type_display,
gradebook_student.year_of_curriculum,
(student_group and student_group.name) or "-",
Expand Down
10 changes: 7 additions & 3 deletions apps/learning/teaching/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ def test_view_assignment_student_answers_csv(client):
teacher = TeacherFactory()
student_one, student_two = StudentFactory.create_batch(2)
course = CourseFactory(teachers=[teacher])
EnrollmentFactory(course=course, student=student_one)
EnrollmentFactory(course=course, student=student_two)
enrollment_one = EnrollmentFactory(course=course, student=student_one)
enrollment_two = EnrollmentFactory(course=course, student=student_two)
assignment = AssignmentFactory(course=course, submission_type=AssignmentFormat.CODE_REVIEW)
csv_download_url = reverse('teaching:assignment_student_answers_csv', args=[assignment.pk])
sa_one = StudentAssignment.objects.get(student=student_one)
Expand All @@ -579,6 +579,7 @@ def test_view_assignment_student_answers_csv(client):

headers = [
"Профиль на сайте",
"id",
"Фамилия",
"Имя",
"Отчество",
Expand All @@ -598,6 +599,7 @@ def test_view_assignment_student_answers_csv(client):

student_one_row = [
student_one.get_absolute_url(),
str(enrollment_one.id),
student_one.last_name,
student_one.first_name,
student_one.patronymic,
Expand All @@ -606,6 +608,7 @@ def test_view_assignment_student_answers_csv(client):
]
student_two_row = [
student_two.get_absolute_url(),
str(enrollment_two.id),
student_two.last_name,
student_two.first_name,
student_two.patronymic,
Expand All @@ -624,6 +627,7 @@ def test_view_assignment_student_answers_csv(client):
text="comment_three")
student_one_row_extra = [
student_one.get_absolute_url(),
str(enrollment_one.id),
student_one.last_name,
student_one.first_name,
student_one.patronymic,
Expand All @@ -635,7 +639,7 @@ def test_view_assignment_student_answers_csv(client):
student_two.branch = branch
student_two.save()

student_two_row[4] = branch.name
student_two_row[5] = branch.name

status_log_csv = client.get(csv_download_url).content.decode('utf-8')
data = [s for s in csv.reader(io.StringIO(status_log_csv)) if s]
Expand Down
6 changes: 5 additions & 1 deletion apps/learning/teaching/views/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,22 +341,26 @@ def get(self, request, *args, **kwargs):
writer = csv.writer(response)
headers = [
"Профиль на сайте",
"id",
"Фамилия",
"Имя",
"Отчество",
"Отделение",
"Текстовый ответ"
]
writer.writerow(headers)
enrollment_subquery = Enrollment.active.filter(student=OuterRef('author'), course=assignment.course).values('id')[:1]
comments = (AssignmentComment.objects
.filter(is_published=True,
student_assignment__assignment=assignment,
author=F('student_assignment__student'))
.select_related('author__branch')
.annotate(enrollment_id=Subquery(enrollment_subquery))
.order_by('student_assignment__student', 'created'))
for comment in comments:
student = comment.author
writer.writerow([student.get_absolute_url(), student.last_name, student.first_name, student.patronymic,
writer.writerow([student.get_absolute_url(), comment.enrollment_id,
student.last_name, student.first_name, student.patronymic,
value.name if (value := student.branch) else "Не выставлено",
value if (value := comment.text) else "-",
])
Expand Down
2 changes: 1 addition & 1 deletion apps/projects/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2022-02-21 15:24+0000\n"
"Last-Translator: Сергей Жеревчук <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion apps/surveys/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2019-10-31 16:30+0000\n"
"Last-Translator: b' <[email protected]>'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion compscicenter_ru/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2020-02-03 16:52+0000\n"
"Last-Translator: b' <[email protected]>'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion compsciclub_ru/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2020-09-09 04:43+0000\n"
"Last-Translator: b' <[email protected]>'\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
4 changes: 2 additions & 2 deletions lms/jinja2/lms/teaching/assignment_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ <h2>
{% if can_edit_assignment or can_delete_assignment or can_download_status_report or can_download_answers_csv %}
<div class="btn-toolbar">
{% if can_download_status_report %}
<a href="{{ status_report_href }}" class="btn btn-info" role="button">{% trans %}Student Status Log{% endtrans %}</a>
<a href="{{ status_report_href }}" class="btn btn-info" role="button"> <i class="fa fa-download"></i> {% trans %}Student Status Log{% endtrans %}</a>
{% endif %}
{% if can_download_answers_csv %}
<a href="{{ assignment.get_answer_csv_url() }}" class="btn btn-info" role="button">{% trans %}Student answers{% endtrans %}</a>
<a href="{{ assignment.get_answer_csv_url() }}" class="btn btn-info" role="button"> <i class="fa fa-download"></i> {% trans %}Student answers{% endtrans %}</a>
{% endif %}
{% if can_edit_assignment %}
<a href="{{ assignment.get_update_url() }}" class="btn btn-primary" role="button">{% trans %}Edit{% endtrans %}</a>
Expand Down
80 changes: 40 additions & 40 deletions locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-17 12:01+0000\n"
"PO-Revision-Date: 2024-12-17 12:02+0000\n"
"POT-Creation-Date: 2024-12-23 11:52+0000\n"
"PO-Revision-Date: 2024-12-23 11:54+0000\n"
"Last-Translator: Дмитрий Чернушевич <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
Expand Down Expand Up @@ -893,7 +893,7 @@ msgstr "Для URL не указана проверяющая система"

#: apps/courses/forms.py:551 apps/learning/models.py:226
#: apps/users/models.py:1134 lms/jinja2/lms/courses/course_detail.html:117
#: lms/jinja2/lms/courses/course_detail.html:301
#: lms/jinja2/lms/courses/course_detail.html:299
msgid "Teachers"
msgstr "Преподаватели"

Expand Down Expand Up @@ -1411,6 +1411,14 @@ msgstr "Занятия"
msgid "CourseTab|Assignments"
msgstr "Задания"

#: apps/courses/views/course.py:164
msgid "Course is already published"
msgstr "Прочтение курса уже опубликовано"

#: apps/courses/views/course.py:169
msgid "Course is succesfully published"
msgstr "Прочтение курса успешно опубликовано"

#: apps/courses/views/course_class.py:149
#, python-format
msgid "The class '%s' was successfully created."
Expand Down Expand Up @@ -1850,48 +1858,53 @@ msgstr "Отчество"
msgid "Role"
msgstr "Роль"

#: apps/learning/gradebook/views.py:240 apps/users/models.py:826
#: apps/learning/gradebook/views.py:239
#: lms/jinja2/lms/user_profile/_tab_account.html:122
msgid "Email"
msgstr "Почта"

#: apps/learning/gradebook/views.py:241 apps/users/models.py:826
#: lms/jinja2/lms/staff/student_search.html:47
msgid "CSCUser|Curriculum year"
msgstr "Год программы обучения"

#: apps/learning/gradebook/views.py:241 apps/learning/models.py:246
#: apps/learning/gradebook/views.py:242 apps/learning/models.py:246
#: apps/learning/models.py:268
msgid "Group"
msgstr "Группа"

#: apps/learning/gradebook/views.py:242 apps/users/models.py:259
#: apps/learning/gradebook/views.py:243 apps/users/models.py:259
#: apps/users/models.py:368
msgid "Yandex Login"
msgstr "Логин на Яндексе"

#: apps/learning/gradebook/views.py:243
#: apps/learning/gradebook/views.py:244
msgid "Telegram Username"
msgstr "Telegram"

#: apps/learning/gradebook/views.py:245 apps/users/models.py:386
#: apps/learning/gradebook/views.py:246 apps/users/models.py:386
msgid "Codeforces Handle"
msgstr ""

#: apps/learning/gradebook/views.py:248
#: apps/learning/gradebook/views.py:249
msgid "Final grade"
msgstr "Итоговая оценка"

#: apps/learning/gradebook/views.py:249
#: apps/learning/gradebook/views.py:250
#: lms/jinja2/lms/gradebook/gradebook_form.html:123
msgid "Total"
msgstr "Сумма баллов"

#: apps/learning/gradebook/views.py:326
#: apps/learning/gradebook/views.py:328
msgid "Imported records for assignment {} - {} out of {}"
msgstr "Импортировано оценок за задание {} - {} из {} найденных"

#: apps/learning/gradebook/views.py:330
#: apps/learning/gradebook/views.py:332
msgid "<b>Not all records were processed. Import stopped by an error:</b><br>"
msgstr ""
"<b>Не все записи были обработаны. Импорт прекращён из-за ошибки:</b><br>"

#: apps/learning/gradebook/views.py:404
#: apps/learning/gradebook/views.py:406
msgid ""
"Успешно импортированы записи для курса {} - для {} из {} строк с верными "
"идентификаторами студентов."
Expand Down Expand Up @@ -2661,7 +2674,7 @@ msgstr "Новости"
#: apps/learning/tests/test_enrollment.py:135
#: apps/learning/tests/test_enrollment.py:162
#: apps/learning/tests/test_enrollment.py:171
#: lms/jinja2/lms/courses/course_detail.html:268
#: lms/jinja2/lms/courses/course_detail.html:266
msgid "Learner places available"
msgstr "Осталось мест сдавать"

Expand All @@ -2671,7 +2684,7 @@ msgstr "Осталось мест сдавать"
#: apps/learning/tests/test_enrollment.py:136
#: apps/learning/tests/test_enrollment.py:163
#: apps/learning/tests/test_enrollment.py:172
#: lms/jinja2/lms/courses/course_detail.html:271
#: lms/jinja2/lms/courses/course_detail.html:269
msgid "Listener places available"
msgstr "Осталось мест слушать"

Expand All @@ -2685,27 +2698,19 @@ msgstr "Записаться"
msgid "{} hrs {:02d} min"
msgstr "{} ч. {:02d} мин."

#: apps/learning/views/enrollment.py:44 apps/learning/views/enrollment.py:85
#: apps/learning/views/enrollment.py:157 apps/learning/views/enrollment.py:191
#: apps/learning/views/enrollment.py:43 apps/learning/views/enrollment.py:84
#: apps/learning/views/enrollment.py:156 apps/learning/views/enrollment.py:190
msgid "No places available, sorry"
msgstr "Извините, свободных мест не осталось."

#: apps/learning/views/enrollment.py:79 apps/learning/views/enrollment.py:183
#: apps/learning/views/enrollment.py:78 apps/learning/views/enrollment.py:182
msgid "You are successfully enrolled in the course"
msgstr "Вы успешно записались на курс"

#: apps/learning/views/enrollment.py:82 apps/learning/views/enrollment.py:187
#: apps/learning/views/enrollment.py:81 apps/learning/views/enrollment.py:186
msgid "You are already enrolled in the course"
msgstr "Вы уже записаны на этот курс"

#: apps/learning/views/enrollment.py:206
msgid "Course is already published"
msgstr "Прочтение курса уже опубликовано"

#: apps/learning/views/enrollment.py:211
msgid "Course is succesfully published"
msgstr "Прочтение курса успешно опубликовано"

#: apps/library/admin.py:68
msgid "Copies available"
msgstr "Доступно"
Expand Down Expand Up @@ -4013,38 +4018,37 @@ msgstr "удалить"
msgid "edit"
msgstr "редактировать"

#: lms/jinja2/lms/courses/course_detail.html:256
#| msgid "Published"
#: lms/jinja2/lms/courses/course_detail.html:254
msgid "Publish course"
msgstr "Опубликовать курс"

#: lms/jinja2/lms/courses/course_detail.html:261
#: lms/jinja2/lms/courses/course_detail.html:259
#: lms/jinja2/lms/enrollment/invitation_courses.html:31
msgid "Unenroll from the course"
msgstr "Отписаться от курса"

#: lms/jinja2/lms/courses/course_detail.html:266
#: lms/jinja2/lms/courses/course_detail.html:264
msgid "Enroll in the course"
msgstr "Записаться на курс"

#: lms/jinja2/lms/courses/course_detail.html:276
#: lms/jinja2/lms/courses/course_detail.html:274
msgid "Add assignment"
msgstr "Добавить задание"

#: lms/jinja2/lms/courses/course_detail.html:279
#: lms/jinja2/lms/courses/course_detail.html:277
msgid "Edit description"
msgstr "Редактировать описание"

#: lms/jinja2/lms/courses/course_detail.html:282
#: lms/jinja2/lms/courses/course_detail.html:280
#: lms/jinja2/lms/teaching/course_list.html:50
msgid "Add news"
msgstr "Добавить новость"

#: lms/jinja2/lms/courses/course_detail.html:285
#: lms/jinja2/lms/courses/course_detail.html:283
msgid "Add class"
msgstr "Добавить занятие"

#: lms/jinja2/lms/courses/course_detail.html:293
#: lms/jinja2/lms/courses/course_detail.html:291
msgid "Start survey"
msgstr "Оставить отзыв о курсе"

Expand Down Expand Up @@ -4280,10 +4284,6 @@ msgstr "Назад к загрузке фото"
msgid "Online courses"
msgstr "Онлайн-курсы"

#: lms/jinja2/lms/user_profile/_tab_account.html:122
msgid "Email"
msgstr "Email"

#: lms/jinja2/lms/user_profile/_tab_student_profiles.html:73
msgid "Status history"
msgstr "История статусов"
Expand Down

0 comments on commit 5d8ffb9

Please sign in to comment.