evap 0.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of evap might be problematic. Click here for more details.

Files changed (567) hide show
  1. evap/__init__.py +0 -0
  2. evap/__main__.py +18 -0
  3. evap/context_processors.py +26 -0
  4. evap/contributor/__init__.py +0 -0
  5. evap/contributor/forms.py +125 -0
  6. evap/contributor/templates/contributor_evaluation_form.html +154 -0
  7. evap/contributor/templates/contributor_index.html +252 -0
  8. evap/contributor/tests/__init__.py +0 -0
  9. evap/contributor/tests/test_forms.py +203 -0
  10. evap/contributor/tests/test_views.py +287 -0
  11. evap/contributor/urls.py +14 -0
  12. evap/contributor/views.py +304 -0
  13. evap/development/__init__.py +0 -0
  14. evap/development/fixtures/test_data.json +155379 -0
  15. evap/development/fixtures/upload/grades/1525/test_results_01.txt +1 -0
  16. evap/development/fixtures/upload/grades/1577/test_results_03.txt +1 -0
  17. evap/development/fixtures/upload/grades/1694/test_results_02.txt +1 -0
  18. evap/development/localsettings.template.py +59 -0
  19. evap/development/manage_autocompletion.sh +23 -0
  20. evap/development/management/__init__.py +0 -0
  21. evap/development/management/commands/__init__.py +0 -0
  22. evap/development/management/commands/dump_testdata.py +27 -0
  23. evap/development/management/commands/reload_testdata.py +40 -0
  24. evap/development/management/commands/run.py +17 -0
  25. evap/development/management/commands/translate.py +20 -0
  26. evap/development/templates/development_components.html +515 -0
  27. evap/development/tests/__init__.py +0 -0
  28. evap/development/tests/test_commands.py +78 -0
  29. evap/development/urls.py +8 -0
  30. evap/development/views.py +22 -0
  31. evap/evaluation/__init__.py +0 -0
  32. evap/evaluation/auth.py +163 -0
  33. evap/evaluation/forms.py +158 -0
  34. evap/evaluation/management/__init__.py +0 -0
  35. evap/evaluation/management/commands/__init__.py +0 -0
  36. evap/evaluation/management/commands/anonymize.py +281 -0
  37. evap/evaluation/management/commands/anonymize_data/first_names.txt +5163 -0
  38. evap/evaluation/management/commands/anonymize_data/last_names.txt +5000 -0
  39. evap/evaluation/management/commands/anonymize_data/lorem_ipsum.txt +1 -0
  40. evap/evaluation/management/commands/format.py +14 -0
  41. evap/evaluation/management/commands/lint.py +17 -0
  42. evap/evaluation/management/commands/loaddata_unlogged.py +12 -0
  43. evap/evaluation/management/commands/precommit.py +25 -0
  44. evap/evaluation/management/commands/refresh_results_cache.py +35 -0
  45. evap/evaluation/management/commands/scss.py +41 -0
  46. evap/evaluation/management/commands/send_reminders.py +112 -0
  47. evap/evaluation/management/commands/tools.py +49 -0
  48. evap/evaluation/management/commands/ts.py +67 -0
  49. evap/evaluation/management/commands/typecheck.py +12 -0
  50. evap/evaluation/management/commands/update_evaluation_states.py +12 -0
  51. evap/evaluation/middleware.py +32 -0
  52. evap/evaluation/migrations/0001_initial.py +278 -0
  53. evap/evaluation/migrations/0002_initial_data.py +30 -0
  54. evap/evaluation/migrations/0003_auto_add_course_is_graded.py +24 -0
  55. evap/evaluation/migrations/0004_evaluation_start_email_template.py +24 -0
  56. evap/evaluation/migrations/0005_auto_20150115_1717.py +17 -0
  57. evap/evaluation/migrations/0006_archiving_and_order_default.py +48 -0
  58. evap/evaluation/migrations/0007_fsmfield_python3.py +18 -0
  59. evap/evaluation/migrations/0008_make_course_state_protected.py +18 -0
  60. evap/evaluation/migrations/0009_add_textanswer_state.py +16 -0
  61. evap/evaluation/migrations/0010_fill_textanswer_state.py +42 -0
  62. evap/evaluation/migrations/0011_remove_textanswer_checked_and_hidden.py +19 -0
  63. evap/evaluation/migrations/0012_change_questionnaire_ordering.py +15 -0
  64. evap/evaluation/migrations/0013_rename_kind_to_type.py +27 -0
  65. evap/evaluation/migrations/0014_create_degree_model.py +24 -0
  66. evap/evaluation/migrations/0014_rename_lecturer.py +28 -0
  67. evap/evaluation/migrations/0015_initial_degrees.py +26 -0
  68. evap/evaluation/migrations/0016_apply_course_degrees.py +36 -0
  69. evap/evaluation/migrations/0017_delete_old_degrees.py +23 -0
  70. evap/evaluation/migrations/0018_unique_degrees.py +23 -0
  71. evap/evaluation/migrations/0019_merge.py +9 -0
  72. evap/evaluation/migrations/0020_change_vote_date_texts.py +23 -0
  73. evap/evaluation/migrations/0021_django_1_8_upgrade.py +21 -0
  74. evap/evaluation/migrations/0022_gradeanswercounter_likertanswercounter.py +40 -0
  75. evap/evaluation/migrations/0023_create_answer_counters.py +29 -0
  76. evap/evaluation/migrations/0024_remove_likertanswers_and_gradeanswers.py +33 -0
  77. evap/evaluation/migrations/0025_single_result_questionnaire.py +22 -0
  78. evap/evaluation/migrations/0026_make_result_counters_unique.py +19 -0
  79. evap/evaluation/migrations/0027_course_is_required_for_reward.py +16 -0
  80. evap/evaluation/migrations/0028_make_vote_dates_non_null.py +21 -0
  81. evap/evaluation/migrations/0029_user_sorting_and_related_names_to_contribution.py +31 -0
  82. evap/evaluation/migrations/0030_change_course_ordering.py +15 -0
  83. evap/evaluation/migrations/0031_add_rating_answer_counter.py +30 -0
  84. evap/evaluation/migrations/0032_populate_rating_answer_counters.py +21 -0
  85. evap/evaluation/migrations/0033_remove_likert_and_grade_answer.py +41 -0
  86. evap/evaluation/migrations/0034_course_gets_no_grade_documents.py +16 -0
  87. evap/evaluation/migrations/0035_contribution_comment_visibility.py +25 -0
  88. evap/evaluation/migrations/0036_contribution_label.py +16 -0
  89. evap/evaluation/migrations/0037_specify_on_delete.py +45 -0
  90. evap/evaluation/migrations/0038_questionnaire_staff_only.py +17 -0
  91. evap/evaluation/migrations/0039_auto_20160104_1726.py +17 -0
  92. evap/evaluation/migrations/0040_add_semester_is_archived.py +18 -0
  93. evap/evaluation/migrations/0041_populate_semester_is_archived.py +34 -0
  94. evap/evaluation/migrations/0042_populate_single_result_participant_count.py +40 -0
  95. evap/evaluation/migrations/0043_auto_20160221_1543.py +24 -0
  96. evap/evaluation/migrations/0044_add_course_type_model.py +49 -0
  97. evap/evaluation/migrations/0045_populate_course_types.py +31 -0
  98. evap/evaluation/migrations/0046_delete_old_course_type.py +23 -0
  99. evap/evaluation/migrations/0047_add_related_name_for_degrees.py +18 -0
  100. evap/evaluation/migrations/0048_auto_20160301_1438.py +25 -0
  101. evap/evaluation/migrations/0049_rename_course_states.py +28 -0
  102. evap/evaluation/migrations/0050_auto_20160509_1943.py +26 -0
  103. evap/evaluation/migrations/0051_change_question_order_verbose.py +18 -0
  104. evap/evaluation/migrations/0052_add_course_is_private.py +18 -0
  105. evap/evaluation/migrations/0053_create_cronjob_user.py +26 -0
  106. evap/evaluation/migrations/0054_userprofile_language.py +18 -0
  107. evap/evaluation/migrations/0055_reviewer_group.py +22 -0
  108. evap/evaluation/migrations/0056_alter_userprofile_email.py +18 -0
  109. evap/evaluation/migrations/0057_alter_and_rename_vote_start_date.py +23 -0
  110. evap/evaluation/migrations/0058_userprofile_is_active.py +18 -0
  111. evap/evaluation/migrations/0059_add_yes_no_questions.py +18 -0
  112. evap/evaluation/migrations/0060_change_text_fields_to_char_fields.py +43 -0
  113. evap/evaluation/migrations/0061_editor_review_reminder_template.py +31 -0
  114. evap/evaluation/migrations/0062_replace_textanswer_id_with_uuid.py +56 -0
  115. evap/evaluation/migrations/0063_add_heading_question_type.py +18 -0
  116. evap/evaluation/migrations/0064_questionnaire_index_rename.py +22 -0
  117. evap/evaluation/migrations/0065_questionnaire_type.py +41 -0
  118. evap/evaluation/migrations/0066_rename_course_is_required_for_reward.py +25 -0
  119. evap/evaluation/migrations/0067_course_is_midterm_evaluation.py +18 -0
  120. evap/evaluation/migrations/0068_course_can_publish_text_results.py +30 -0
  121. evap/evaluation/migrations/0069_delete_hidden_text_answers.py +19 -0
  122. evap/evaluation/migrations/0070_add_answer_field_for_textanswer.py +46 -0
  123. evap/evaluation/migrations/0071_remove_reviewed_answer_field_for_textanswers.py +22 -0
  124. evap/evaluation/migrations/0072_delete_original_answers.py +19 -0
  125. evap/evaluation/migrations/0073_rename_is_archived_to_participations_are_archived.py +23 -0
  126. evap/evaluation/migrations/0074_semester_grade_documents_are_deleted.py +18 -0
  127. evap/evaluation/migrations/0075_semester_results_are_archived.py +18 -0
  128. evap/evaluation/migrations/0076_add_semester_short_names.py +53 -0
  129. evap/evaluation/migrations/0077_course_is_single_result.py +32 -0
  130. evap/evaluation/migrations/0078_populate_voter_and_participant_count.py +33 -0
  131. evap/evaluation/migrations/0079_rename_staff_to_manager.py +38 -0
  132. evap/evaluation/migrations/0080_add_order_to_coursetype.py +22 -0
  133. evap/evaluation/migrations/0081_create_direct_delegation_email_template.py +27 -0
  134. evap/evaluation/migrations/0082_add_related_names_fix_verbose_name.py +29 -0
  135. evap/evaluation/migrations/0083_remove_general_contributions_on_single_results.py +31 -0
  136. evap/evaluation/migrations/0084_rename_course_comments_to_general_comments.py +32 -0
  137. evap/evaluation/migrations/0085_delete_cronjob_user.py +35 -0
  138. evap/evaluation/migrations/0086_downgrade_comment_visibility.py +29 -0
  139. evap/evaluation/migrations/0087_rename_comment_visibility_to_textanswer_visibility.py +23 -0
  140. evap/evaluation/migrations/0088_prepare_use_integers_and_groups_for_question_type.py +40 -0
  141. evap/evaluation/migrations/0089_use_integers_for_question_type.py +47 -0
  142. evap/evaluation/migrations/0090_add_bipolar_question_type.py +43 -0
  143. evap/evaluation/migrations/0091_rename_course_to_evaluation.py +72 -0
  144. evap/evaluation/migrations/0092_add_course.py +60 -0
  145. evap/evaluation/migrations/0093_move_data_from_evaluation_to_course.py +50 -0
  146. evap/evaluation/migrations/0094_remove_unused_evaluation_fields.py +45 -0
  147. evap/evaluation/migrations/0095_add_course_responsibles.py +19 -0
  148. evap/evaluation/migrations/0096_move_responsibilities_into_course.py +34 -0
  149. evap/evaluation/migrations/0097_remove_contribution_responsible.py +17 -0
  150. evap/evaluation/migrations/0098_remove_contributors_from_single_results.py +49 -0
  151. evap/evaluation/migrations/0099_multiple_evaluations_per_course.py +23 -0
  152. evap/evaluation/migrations/0100_clear_evaluation_names.py +55 -0
  153. evap/evaluation/migrations/0101_evaluation_weight.py +18 -0
  154. evap/evaluation/migrations/0102_individual_publishing_notice_email_template.py +31 -0
  155. evap/evaluation/migrations/0103_questionnaire_visibility.py +54 -0
  156. evap/evaluation/migrations/0104_userprofile_is_proxy_user.py +18 -0
  157. evap/evaluation/migrations/0105_uuids_for_ratinganswercounter.py +51 -0
  158. evap/evaluation/migrations/0106_add_short_long_question.py +37 -0
  159. evap/evaluation/migrations/0107_remove_default_evaluation_ordering.py +17 -0
  160. evap/evaluation/migrations/0108_remove_default_name_de_ordering.py +25 -0
  161. evap/evaluation/migrations/0109_questionnaire_is_locked.py +18 -0
  162. evap/evaluation/migrations/0110_semester_is_active.py +28 -0
  163. evap/evaluation/migrations/0111_move_grading_information_from_course_to_evaluation.py +36 -0
  164. evap/evaluation/migrations/0112_evaluation_allow_editors_to_edit.py +18 -0
  165. evap/evaluation/migrations/0113_import_names.py +50 -0
  166. evap/evaluation/migrations/0114_remove_username.py +21 -0
  167. evap/evaluation/migrations/0115_add_contribution_role.py +33 -0
  168. evap/evaluation/migrations/0116_remove_contributon_can_edit.py +15 -0
  169. evap/evaluation/migrations/0117_logentry.py +40 -0
  170. evap/evaluation/migrations/0118_remove_last_modified_fields.py +29 -0
  171. evap/evaluation/migrations/0119_contribution_verbose_name.py +17 -0
  172. evap/evaluation/migrations/0120_use_django_db_models_jsonfield.py +19 -0
  173. evap/evaluation/migrations/0121_add_allows_textanswers_to_question.py +33 -0
  174. evap/evaluation/migrations/0122_prepare_evaluation_state_fsm_int.py +17 -0
  175. evap/evaluation/migrations/0123_evaluation_state_fsm_int.py +81 -0
  176. evap/evaluation/migrations/0124_add_html_content.py +30 -0
  177. evap/evaluation/migrations/0125_use_lists_for_ordering.py +29 -0
  178. evap/evaluation/migrations/0126_add_textanswer_review_email_template.py +25 -0
  179. evap/evaluation/migrations/0127_fix_logentry_types.py +19 -0
  180. evap/evaluation/migrations/0128_django_40_noop.py +31 -0
  181. evap/evaluation/migrations/0129_rename_state_textanswer_review_decision.py +16 -0
  182. evap/evaluation/migrations/0130_alter_textanswer_review_decision.py +34 -0
  183. evap/evaluation/migrations/0131_userprofile_ordering.py +26 -0
  184. evap/evaluation/migrations/0132_textanswer_is_flagged.py +16 -0
  185. evap/evaluation/migrations/0133_add_infotext_model.py +44 -0
  186. evap/evaluation/migrations/0134_userprofile_display_name.py +44 -0
  187. evap/evaluation/migrations/0135_consistent_no_data_representation_on_text_fields.py +96 -0
  188. evap/evaluation/migrations/0136_alter_userprofile_first_name_chosen_and_more.py +28 -0
  189. evap/evaluation/migrations/0137_use_more_database_constraints.py +55 -0
  190. evap/evaluation/migrations/0138_votetimestamp.py +25 -0
  191. evap/evaluation/migrations/0139_userprofile_startpage.py +22 -0
  192. evap/evaluation/migrations/0140_alter_question_type.py +37 -0
  193. evap/evaluation/migrations/0141_userprofile_notes.py +17 -0
  194. evap/evaluation/migrations/0142_alter_evaluation_state.py +18 -0
  195. evap/evaluation/migrations/0143_alter_evaluation_state.py +33 -0
  196. evap/evaluation/migrations/0144_alter_evaluation_state.py +33 -0
  197. evap/evaluation/migrations/0145_rename_degree_to_program.py +30 -0
  198. evap/evaluation/migrations/0146_grade_reminder_template.py +31 -0
  199. evap/evaluation/migrations/0147_unusable_password_default.py +24 -0
  200. evap/evaluation/migrations/__init__.py +0 -0
  201. evap/evaluation/models.py +2368 -0
  202. evap/evaluation/models_logging.py +368 -0
  203. evap/evaluation/templates/400.html +10 -0
  204. evap/evaluation/templates/403.html +10 -0
  205. evap/evaluation/templates/404.html +10 -0
  206. evap/evaluation/templates/500.html +10 -0
  207. evap/evaluation/templates/base.html +223 -0
  208. evap/evaluation/templates/base_empty.html +5 -0
  209. evap/evaluation/templates/bootstrap_datetimepicker.html +32 -0
  210. evap/evaluation/templates/bootstrap_form.html +13 -0
  211. evap/evaluation/templates/bootstrap_form_errors.html +3 -0
  212. evap/evaluation/templates/bootstrap_form_field.html +16 -0
  213. evap/evaluation/templates/bootstrap_form_field_label.html +3 -0
  214. evap/evaluation/templates/bootstrap_form_field_widget.html +5 -0
  215. evap/evaluation/templates/bootstrap_form_pill_group.html +18 -0
  216. evap/evaluation/templates/choice_button.html +12 -0
  217. evap/evaluation/templates/confirmation_modal_template.html +33 -0
  218. evap/evaluation/templates/contact_modal.html +55 -0
  219. evap/evaluation/templates/contribution_formset.html +77 -0
  220. evap/evaluation/templates/course_badges.html +5 -0
  221. evap/evaluation/templates/custom_elements.html +9 -0
  222. evap/evaluation/templates/django/forms/widgets/checkbox.html +6 -0
  223. evap/evaluation/templates/django/forms/widgets/input.html +1 -0
  224. evap/evaluation/templates/django/forms/widgets/select.html +13 -0
  225. evap/evaluation/templates/django/forms/widgets/textarea.html +2 -0
  226. evap/evaluation/templates/email_base.html +62 -0
  227. evap/evaluation/templates/evaluation_badges.html +20 -0
  228. evap/evaluation/templates/evaluation_form_general_questionnaires.html +17 -0
  229. evap/evaluation/templates/evap_evaluation_edit_js.html +78 -0
  230. evap/evaluation/templates/external_user_confirm_login.html +28 -0
  231. evap/evaluation/templates/faq.html +50 -0
  232. evap/evaluation/templates/footer.html +33 -0
  233. evap/evaluation/templates/index.html +82 -0
  234. evap/evaluation/templates/infobox.html +26 -0
  235. evap/evaluation/templates/legal_notice.html +12 -0
  236. evap/evaluation/templates/log/changed_fields_entry.html +29 -0
  237. evap/evaluation/templates/log/logentries.html +30 -0
  238. evap/evaluation/templates/multiple_checkbox_widget.html +10 -0
  239. evap/evaluation/templates/navbar.html +134 -0
  240. evap/evaluation/templates/notebook.html +42 -0
  241. evap/evaluation/templates/profile.html +95 -0
  242. evap/evaluation/templates/progress_bar.html +16 -0
  243. evap/evaluation/templates/progress_bar_fill.html +15 -0
  244. evap/evaluation/templates/questionnaires_widget.html +37 -0
  245. evap/evaluation/templates/role_buttons.html +12 -0
  246. evap/evaluation/templates/startpage_button.html +13 -0
  247. evap/evaluation/templates/textanswer_visibility_buttons.html +10 -0
  248. evap/evaluation/templates/textanswer_visibility_info.html +10 -0
  249. evap/evaluation/templates/user_list_with_links.html +11 -0
  250. evap/evaluation/templatetags/__init__.py +0 -0
  251. evap/evaluation/templatetags/evaluation_filters.py +232 -0
  252. evap/evaluation/templatetags/infotext_templatetags.py +16 -0
  253. evap/evaluation/templatetags/navbar_templatetags.py +34 -0
  254. evap/evaluation/tests/__init__.py +0 -0
  255. evap/evaluation/tests/test_auth.py +268 -0
  256. evap/evaluation/tests/test_commands.py +539 -0
  257. evap/evaluation/tests/test_forms.py +54 -0
  258. evap/evaluation/tests/test_live.py +25 -0
  259. evap/evaluation/tests/test_misc.py +62 -0
  260. evap/evaluation/tests/test_models.py +1141 -0
  261. evap/evaluation/tests/test_models_logging.py +149 -0
  262. evap/evaluation/tests/test_tools.py +198 -0
  263. evap/evaluation/tests/test_views.py +276 -0
  264. evap/evaluation/tests/tools.py +317 -0
  265. evap/evaluation/tools.py +292 -0
  266. evap/evaluation/urls.py +17 -0
  267. evap/evaluation/views.py +248 -0
  268. evap/grades/__init__.py +0 -0
  269. evap/grades/forms.py +53 -0
  270. evap/grades/migrations/0001_initial.py +30 -0
  271. evap/grades/migrations/0002_initial_data.py +17 -0
  272. evap/grades/migrations/0003_add_upload_path_and_change_last_modified_user_related_name.py +24 -0
  273. evap/grades/migrations/0004_rename_preliminary_to_midterm.py +25 -0
  274. evap/grades/migrations/0005_make_description_unique_per_course.py +15 -0
  275. evap/grades/migrations/0006_specify_on_delete.py +19 -0
  276. evap/grades/migrations/0007_semestergradedownloadactivation.py +23 -0
  277. evap/grades/migrations/0008_add_gradedocument_description_en.py +33 -0
  278. evap/grades/migrations/0009_fill_description_en.py +22 -0
  279. evap/grades/migrations/0010_gradedocument_description_en_add_unique.py +17 -0
  280. evap/grades/migrations/0011_auto_20160301_1438.py +20 -0
  281. evap/grades/migrations/0012_remove_semester_grade_download_activation.py +20 -0
  282. evap/grades/migrations/0013_prepare_rename_course_to_evaluation.py +19 -0
  283. evap/grades/migrations/0014_rename_course_to_evaluation.py +23 -0
  284. evap/grades/migrations/0015_add_grade_documents_on_course.py +28 -0
  285. evap/grades/migrations/0016_move_grade_documents_to_course.py +27 -0
  286. evap/grades/migrations/0017_remove_grade_documents_from_evaluations.py +29 -0
  287. evap/grades/migrations/__init__.py +0 -0
  288. evap/grades/models.py +67 -0
  289. evap/grades/templates/grade_document_file_widget.html +6 -0
  290. evap/grades/templates/grades_base.html +17 -0
  291. evap/grades/templates/grades_course_base.html +14 -0
  292. evap/grades/templates/grades_course_view.html +71 -0
  293. evap/grades/templates/grades_index.html +22 -0
  294. evap/grades/templates/grades_semester_base.html +16 -0
  295. evap/grades/templates/grades_semester_view.html +147 -0
  296. evap/grades/templates/grades_upload_form.html +38 -0
  297. evap/grades/tests.py +283 -0
  298. evap/grades/urls.py +17 -0
  299. evap/grades/views.py +216 -0
  300. evap/locale/__init__.py +0 -0
  301. evap/locale/de/LC_MESSAGES/django.po +5870 -0
  302. evap/locale/de/LC_MESSAGES/djangojs.po +31 -0
  303. evap/locale/de/__init__.py +0 -0
  304. evap/locale/de/formats.py +1 -0
  305. evap/locale/en/__init__.py +0 -0
  306. evap/locale/en/formats.py +11 -0
  307. evap/middleware.py +53 -0
  308. evap/results/__init__.py +0 -0
  309. evap/results/exporters.py +417 -0
  310. evap/results/fixtures/minimal_test_data_results.json +538 -0
  311. evap/results/templates/distribution_widget.html +26 -0
  312. evap/results/templates/distribution_with_grade.html +51 -0
  313. evap/results/templates/distribution_with_grade_disabled.html +9 -0
  314. evap/results/templates/evaluation_result_widget.html +17 -0
  315. evap/results/templates/result_widget_tooltip.html +26 -0
  316. evap/results/templates/results_evaluation_detail.html +232 -0
  317. evap/results/templates/results_evaluation_detail_questionnaires.html +41 -0
  318. evap/results/templates/results_index.html +173 -0
  319. evap/results/templates/results_index_course.html +8 -0
  320. evap/results/templates/results_index_course_impl.html +30 -0
  321. evap/results/templates/results_index_evaluation.html +8 -0
  322. evap/results/templates/results_index_evaluation_impl.html +69 -0
  323. evap/results/templates/results_widget_range_slider.html +9 -0
  324. evap/results/templates/textanswer_list.html +23 -0
  325. evap/results/templatetags/__init__.py +0 -0
  326. evap/results/templatetags/results_templatetags.py +56 -0
  327. evap/results/tests/__init__.py +0 -0
  328. evap/results/tests/test_exporters.py +591 -0
  329. evap/results/tests/test_live.py +181 -0
  330. evap/results/tests/test_tools.py +588 -0
  331. evap/results/tests/test_views.py +1147 -0
  332. evap/results/tools.py +521 -0
  333. evap/results/urls.py +11 -0
  334. evap/results/views.py +436 -0
  335. evap/rewards/__init__.py +0 -0
  336. evap/rewards/exporters.py +21 -0
  337. evap/rewards/forms.py +109 -0
  338. evap/rewards/migrations/0001_initial.py +73 -0
  339. evap/rewards/migrations/0002_django18warning.py +17 -0
  340. evap/rewards/migrations/0003_specify_on_delete.py +24 -0
  341. evap/rewards/migrations/0004_make_granting_semester_non_null.py +19 -0
  342. evap/rewards/migrations/0005_alter_rewardpoint_minvalue.py +23 -0
  343. evap/rewards/migrations/0006_rewardpointredemptionevent_step.py +20 -0
  344. evap/rewards/migrations/0007_localize_rewardpointredemption_name.py +42 -0
  345. evap/rewards/migrations/__init__.py +0 -0
  346. evap/rewards/models.py +60 -0
  347. evap/rewards/templates/rewards_index.html +96 -0
  348. evap/rewards/templates/rewards_reward_point_redemption_event_form.html +28 -0
  349. evap/rewards/templates/rewards_reward_point_redemption_event_list.html +54 -0
  350. evap/rewards/templates/rewards_reward_point_redemption_events.html +51 -0
  351. evap/rewards/tests/__init__.py +0 -0
  352. evap/rewards/tests/test_tools.py +106 -0
  353. evap/rewards/tests/test_views.py +254 -0
  354. evap/rewards/tools.py +126 -0
  355. evap/rewards/urls.py +18 -0
  356. evap/rewards/views.py +191 -0
  357. evap/settings.py +493 -0
  358. evap/settings_test.py +30 -0
  359. evap/staff/__init__.py +0 -0
  360. evap/staff/fixtures/__init__.py +0 -0
  361. evap/staff/fixtures/excel_files_test_data.py +241 -0
  362. evap/staff/fixtures/invalid_user_import.xlsx +0 -0
  363. evap/staff/fixtures/test_user_bulk_update_file.txt +4 -0
  364. evap/staff/fixtures/valid_user_import.xlsx +0 -0
  365. evap/staff/forms.py +1137 -0
  366. evap/staff/importers/__init__.py +13 -0
  367. evap/staff/importers/base.py +306 -0
  368. evap/staff/importers/enrollment.py +893 -0
  369. evap/staff/importers/person.py +119 -0
  370. evap/staff/importers/user.py +398 -0
  371. evap/staff/staff_mode.py +71 -0
  372. evap/staff/templates/staff_base.html +17 -0
  373. evap/staff/templates/staff_course_base.html +23 -0
  374. evap/staff/templates/staff_course_copyform.html +44 -0
  375. evap/staff/templates/staff_course_form.html +55 -0
  376. evap/staff/templates/staff_course_type_index.html +89 -0
  377. evap/staff/templates/staff_course_type_merge.html +39 -0
  378. evap/staff/templates/staff_course_type_merge_selection.html +27 -0
  379. evap/staff/templates/staff_email_preview_form.html +38 -0
  380. evap/staff/templates/staff_evaluation_base.html +19 -0
  381. evap/staff/templates/staff_evaluation_email.html +51 -0
  382. evap/staff/templates/staff_evaluation_evaluation_period.html +27 -0
  383. evap/staff/templates/staff_evaluation_form.html +68 -0
  384. evap/staff/templates/staff_evaluation_operation.html +103 -0
  385. evap/staff/templates/staff_evaluation_person_management.html +226 -0
  386. evap/staff/templates/staff_evaluation_textanswer_edit.html +25 -0
  387. evap/staff/templates/staff_evaluation_textanswer_flag_radios.html +40 -0
  388. evap/staff/templates/staff_evaluation_textanswers.html +64 -0
  389. evap/staff/templates/staff_evaluation_textanswers_full.html +43 -0
  390. evap/staff/templates/staff_evaluation_textanswers_quick.html +205 -0
  391. evap/staff/templates/staff_evaluation_textanswers_section.html +68 -0
  392. evap/staff/templates/staff_faq_index.html +76 -0
  393. evap/staff/templates/staff_faq_section.html +72 -0
  394. evap/staff/templates/staff_index.html +81 -0
  395. evap/staff/templates/staff_infotexts.html +40 -0
  396. evap/staff/templates/staff_message_rendering_template.html +48 -0
  397. evap/staff/templates/staff_program_index.html +86 -0
  398. evap/staff/templates/staff_questionnaire_base.html +15 -0
  399. evap/staff/templates/staff_questionnaire_form.html +118 -0
  400. evap/staff/templates/staff_questionnaire_index.html +121 -0
  401. evap/staff/templates/staff_questionnaire_index_list.html +82 -0
  402. evap/staff/templates/staff_questionnaire_view.html +15 -0
  403. evap/staff/templates/staff_semester_base.html +20 -0
  404. evap/staff/templates/staff_semester_export.html +84 -0
  405. evap/staff/templates/staff_semester_flagged_textanswers.html +35 -0
  406. evap/staff/templates/staff_semester_form.html +18 -0
  407. evap/staff/templates/staff_semester_grade_reminder.html +26 -0
  408. evap/staff/templates/staff_semester_import.html +59 -0
  409. evap/staff/templates/staff_semester_preparation_reminder.html +84 -0
  410. evap/staff/templates/staff_semester_questionnaire_assign_form.html +28 -0
  411. evap/staff/templates/staff_semester_send_reminder.html +32 -0
  412. evap/staff/templates/staff_semester_view.html +648 -0
  413. evap/staff/templates/staff_semester_view_evaluation.html +239 -0
  414. evap/staff/templates/staff_single_result_form.html +32 -0
  415. evap/staff/templates/staff_template_form.html +50 -0
  416. evap/staff/templates/staff_text_answer_warnings.html +117 -0
  417. evap/staff/templates/staff_user_badges.html +28 -0
  418. evap/staff/templates/staff_user_bulk_update.html +32 -0
  419. evap/staff/templates/staff_user_form.html +145 -0
  420. evap/staff/templates/staff_user_import.html +58 -0
  421. evap/staff/templates/staff_user_index.html +43 -0
  422. evap/staff/templates/staff_user_list.html +77 -0
  423. evap/staff/templates/staff_user_merge.html +251 -0
  424. evap/staff/templates/staff_user_merge_grouped_list.html +14 -0
  425. evap/staff/templates/staff_user_merge_reward_points_list.html +16 -0
  426. evap/staff/templates/staff_user_merge_selection.html +57 -0
  427. evap/staff/tests/__init__.py +0 -0
  428. evap/staff/tests/test_forms.py +1149 -0
  429. evap/staff/tests/test_importers.py +1068 -0
  430. evap/staff/tests/test_live.py +73 -0
  431. evap/staff/tests/test_tools.py +304 -0
  432. evap/staff/tests/test_views.py +3902 -0
  433. evap/staff/tests/utils.py +65 -0
  434. evap/staff/tools.py +380 -0
  435. evap/staff/urls.py +102 -0
  436. evap/staff/views.py +2602 -0
  437. evap/static/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
  438. evap/static/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
  439. evap/static/css/bootstrap-datetimepicker.min.css +5 -0
  440. evap/static/css/evap.css +9 -0
  441. evap/static/css/tom-select.bootstrap5.min.css +2 -0
  442. evap/static/css/tom-select.bootstrap5.min.css.map +1 -0
  443. evap/static/font-awesome/webfonts/fa-regular-400.woff2 +0 -0
  444. evap/static/font-awesome/webfonts/fa-solid-900.woff2 +0 -0
  445. evap/static/images/evap.png +0 -0
  446. evap/static/images/favicon_16.png +0 -0
  447. evap/static/images/favicon_32.png +0 -0
  448. evap/static/images/favicon_64.png +0 -0
  449. evap/static/images/favicon_gray.png +0 -0
  450. evap/static/images/triangles_color.svg +160 -0
  451. evap/static/images/triangles_gray.svg +154 -0
  452. evap/static/js/.gitignore +3 -0
  453. evap/static/js/Sortable.min.js +2 -0
  454. evap/static/js/auto-form-saver.js +148 -0
  455. evap/static/js/base-template.js +12 -0
  456. evap/static/js/bootstrap-datetimepicker.min.js +2 -0
  457. evap/static/js/confirmation-modal.js +61 -0
  458. evap/static/js/contact_modal.js +52 -0
  459. evap/static/js/copy-to-clipboard.js +4 -0
  460. evap/static/js/csrf-utils.js +19 -0
  461. evap/static/js/custom-success-form.js +33 -0
  462. evap/static/js/datagrid.js +392 -0
  463. evap/static/js/infobox.js +32 -0
  464. evap/static/js/jquery-2.1.3.min.js +4 -0
  465. evap/static/js/moment.min.js +2 -0
  466. evap/static/js/moment.min.js.map +1 -0
  467. evap/static/js/moment_de.js +1 -0
  468. evap/static/js/notebook.js +64 -0
  469. evap/static/js/plugins/jquery.formset.js +213 -0
  470. evap/static/js/quick-review-slider.js +381 -0
  471. evap/static/js/slider.js +59 -0
  472. evap/static/js/sortable-form.js +75 -0
  473. evap/static/js/student-vote.js +157 -0
  474. evap/static/js/text-answer-warnings.js +47 -0
  475. evap/static/js/tom-select.complete.min.js +363 -0
  476. evap/static/js/tom-select.complete.min.js.map +1 -0
  477. evap/static/js/translation.js +1 -0
  478. evap/static/js/utils.js +46 -0
  479. evap/static/maintenance/maintenance.html +36 -0
  480. evap/static/sample.xlsx +0 -0
  481. evap/static/sample_user.xlsx +0 -0
  482. evap/static/scss/_adjustments.scss +156 -0
  483. evap/static/scss/_bootstrap.scss +48 -0
  484. evap/static/scss/_colors.scss +48 -0
  485. evap/static/scss/_components.scss +25 -0
  486. evap/static/scss/_font-awesome.scss +23 -0
  487. evap/static/scss/_mixins.scss +67 -0
  488. evap/static/scss/_print.scss +52 -0
  489. evap/static/scss/_utilities.scss +91 -0
  490. evap/static/scss/_variables.scss +91 -0
  491. evap/static/scss/components/_badge.scss +75 -0
  492. evap/static/scss/components/_breadcrumb.scss +31 -0
  493. evap/static/scss/components/_button-group.scss +19 -0
  494. evap/static/scss/components/_buttons.scss +291 -0
  495. evap/static/scss/components/_callouts.scss +97 -0
  496. evap/static/scss/components/_card.scss +114 -0
  497. evap/static/scss/components/_close.scss +8 -0
  498. evap/static/scss/components/_confirmation-modal.scss +87 -0
  499. evap/static/scss/components/_distribution-bar.scss +109 -0
  500. evap/static/scss/components/_dropdown.scss +3 -0
  501. evap/static/scss/components/_forms.scss +73 -0
  502. evap/static/scss/components/_grid.scss +228 -0
  503. evap/static/scss/components/_jumbotron.scss +10 -0
  504. evap/static/scss/components/_modal.scss +31 -0
  505. evap/static/scss/components/_nav.scss +39 -0
  506. evap/static/scss/components/_notebook.scss +84 -0
  507. evap/static/scss/components/_progress.scss +84 -0
  508. evap/static/scss/components/_quick-review.scss +83 -0
  509. evap/static/scss/components/_range-slider.scss +47 -0
  510. evap/static/scss/components/_staff-index.scss +17 -0
  511. evap/static/scss/components/_tables.scss +129 -0
  512. evap/static/scss/components/_tooltip.scss +13 -0
  513. evap/static/scss/components/_transitions.scss +36 -0
  514. evap/static/scss/components/_type.scss +9 -0
  515. evap/static/scss/evap.scss +149 -0
  516. evap/static/ts/.prettierrc.json +5 -0
  517. evap/static/ts/eslint.config.js +53 -0
  518. evap/static/ts/src/auto-form-saver.ts +175 -0
  519. evap/static/ts/src/base-template.ts +11 -0
  520. evap/static/ts/src/confirmation-modal.ts +82 -0
  521. evap/static/ts/src/contact_modal.ts +69 -0
  522. evap/static/ts/src/copy-to-clipboard.ts +3 -0
  523. evap/static/ts/src/csrf-utils.ts +21 -0
  524. evap/static/ts/src/custom-success-form.ts +42 -0
  525. evap/static/ts/src/datagrid.ts +527 -0
  526. evap/static/ts/src/infobox.ts +41 -0
  527. evap/static/ts/src/notebook.ts +80 -0
  528. evap/static/ts/src/quick-review-slider.ts +453 -0
  529. evap/static/ts/src/slider.ts +86 -0
  530. evap/static/ts/src/sortable-form.ts +109 -0
  531. evap/static/ts/src/student-vote.ts +176 -0
  532. evap/static/ts/src/text-answer-warnings.ts +56 -0
  533. evap/static/ts/src/translation.ts +16 -0
  534. evap/static/ts/src/utils.ts +55 -0
  535. evap/static/ts/tests/unit/csrf-utils.ts +23 -0
  536. evap/static/ts/tests/unit/text-answer-warnings.ts +36 -0
  537. evap/static/ts/tests/utils/constants.ts +7 -0
  538. evap/static/ts/tsconfig.compile.json +15 -0
  539. evap/static/ts/tsconfig.json +10 -0
  540. evap/student/__init__.py +0 -0
  541. evap/student/forms.py +95 -0
  542. evap/student/migrations/0001_text_answer_warnings.py +27 -0
  543. evap/student/migrations/__init__.py +0 -0
  544. evap/student/models.py +23 -0
  545. evap/student/templates/student_global_reward.html +53 -0
  546. evap/student/templates/student_index.html +33 -0
  547. evap/student/templates/student_index_evaluation_period.html +28 -0
  548. evap/student/templates/student_index_semester_evaluations_list.html +178 -0
  549. evap/student/templates/student_index_unfinished_evaluations_list.html +34 -0
  550. evap/student/templates/student_text_answer_warnings.html +10 -0
  551. evap/student/templates/student_vote.html +381 -0
  552. evap/student/templates/student_vote_questionnaire_group.html +90 -0
  553. evap/student/templatetags/__init__.py +0 -0
  554. evap/student/templatetags/student_filters.py +8 -0
  555. evap/student/tests/__init__.py +0 -0
  556. evap/student/tests/test_live.py +120 -0
  557. evap/student/tests/test_views.py +561 -0
  558. evap/student/tools.py +8 -0
  559. evap/student/urls.py +10 -0
  560. evap/student/views.py +326 -0
  561. evap/tools.py +42 -0
  562. evap/urls.py +30 -0
  563. evap/wsgi.py +21 -0
  564. evap-0.0.0.dist-info/METADATA +100 -0
  565. evap-0.0.0.dist-info/RECORD +567 -0
  566. evap-0.0.0.dist-info/WHEEL +4 -0
  567. evap-0.0.0.dist-info/licenses/LICENSE.md +38 -0
@@ -0,0 +1,203 @@
1
+ from django.forms.models import inlineformset_factory
2
+ from model_bakery import baker
3
+
4
+ from evap.contributor.forms import EditorContributionForm, EvaluationForm
5
+ from evap.evaluation.models import Contribution, Evaluation, Program, Questionnaire, UserProfile
6
+ from evap.evaluation.tests.tools import TestCase, WebTest, get_form_data_from_instance
7
+ from evap.staff.forms import ContributionFormset
8
+
9
+
10
+ class EvaluationFormTests(TestCase):
11
+ def test_fields_disabled_when_editors_disallowed_to_edit(self):
12
+ evaluation = baker.make(Evaluation)
13
+
14
+ form = EvaluationForm(instance=evaluation)
15
+ self.assertFalse(all(form.fields[field].disabled for field in form.fields))
16
+
17
+ evaluation.allow_editors_to_edit = False
18
+ evaluation.save()
19
+
20
+ form = EvaluationForm(instance=evaluation)
21
+ self.assertTrue(all(form.fields[field].disabled for field in form.fields))
22
+
23
+ def test_edit_participants(self):
24
+ student = baker.make(UserProfile)
25
+ evaluation = baker.make(Evaluation, course__programs=[baker.make(Program)], participants=[student])
26
+ evaluation.general_contribution.questionnaires.set([baker.make(Questionnaire)])
27
+
28
+ form_data = get_form_data_from_instance(EvaluationForm, evaluation)
29
+ form = EvaluationForm(form_data, instance=evaluation)
30
+ self.assertEqual(len(form["participants"].initial), 1)
31
+
32
+ form_data["participants"].remove(student.pk)
33
+ EvaluationForm(form_data, instance=evaluation).save()
34
+ self.assertEqual(evaluation.num_participants, 0)
35
+
36
+ form_data["participants"].append(student.pk)
37
+ EvaluationForm(form_data, instance=evaluation).save()
38
+ del evaluation.num_participants # discard cached property
39
+ self.assertEqual(evaluation.num_participants, 1)
40
+
41
+
42
+ class ContributionFormsetTests(TestCase):
43
+ def test_managers_only(self):
44
+ """
45
+ Asserts that managers_only questionnaires are shown to Editors only if they are already selected for a
46
+ contribution of the Evaluation.
47
+ Regression test for #593.
48
+ """
49
+ evaluation = baker.make(Evaluation)
50
+ questionnaire = baker.make(
51
+ Questionnaire, type=Questionnaire.Type.CONTRIBUTOR, visibility=Questionnaire.Visibility.EDITORS
52
+ )
53
+ questionnaire_managers_only = baker.make(
54
+ Questionnaire, type=Questionnaire.Type.CONTRIBUTOR, visibility=Questionnaire.Visibility.MANAGERS
55
+ )
56
+ # one hidden questionnaire that should never be shown
57
+ baker.make(Questionnaire, type=Questionnaire.Type.CONTRIBUTOR, visibility=Questionnaire.Visibility.HIDDEN)
58
+
59
+ # just the normal questionnaire should be shown.
60
+ contribution1 = baker.make(
61
+ Contribution, evaluation=evaluation, contributor=baker.make(UserProfile), questionnaires=[]
62
+ )
63
+
64
+ InlineContributionFormset = inlineformset_factory(
65
+ Evaluation, Contribution, formset=ContributionFormset, form=EditorContributionForm, extra=1
66
+ )
67
+ formset = InlineContributionFormset(instance=evaluation, form_kwargs={"evaluation": evaluation})
68
+
69
+ expected = {questionnaire}
70
+ self.assertEqual(expected, set(formset.forms[0].fields["questionnaires"].queryset))
71
+ self.assertEqual(expected, set(formset.forms[1].fields["questionnaires"].queryset))
72
+
73
+ # now a manager adds a manager only questionnaire, which should be shown as well
74
+ contribution1.questionnaires.set([questionnaire_managers_only])
75
+
76
+ InlineContributionFormset = inlineformset_factory(
77
+ Evaluation, Contribution, formset=ContributionFormset, form=EditorContributionForm, extra=1
78
+ )
79
+ formset = InlineContributionFormset(instance=evaluation, form_kwargs={"evaluation": evaluation})
80
+
81
+ expected = {questionnaire, questionnaire_managers_only}
82
+ self.assertEqual(expected, set(formset.forms[0].fields["questionnaires"].queryset))
83
+ self.assertEqual(expected, set(formset.forms[1].fields["questionnaires"].queryset))
84
+
85
+ def test_locked_questionnaire(self):
86
+ """
87
+ Asserts that locked (general) questionnaires cannot be changed.
88
+ """
89
+ questionnaire = baker.make(
90
+ Questionnaire, type=Questionnaire.Type.TOP, is_locked=False, visibility=Questionnaire.Visibility.EDITORS
91
+ )
92
+ locked_questionnaire = baker.make(
93
+ Questionnaire, type=Questionnaire.Type.TOP, is_locked=True, visibility=Questionnaire.Visibility.EDITORS
94
+ )
95
+
96
+ evaluation = baker.make(Evaluation)
97
+ evaluation.general_contribution.questionnaires.add(questionnaire)
98
+
99
+ form_data = get_form_data_from_instance(EvaluationForm, evaluation)
100
+ form_data["general_questionnaires"] = [questionnaire.pk, locked_questionnaire.pk] # add locked questionnaire
101
+
102
+ form = EvaluationForm(form_data, instance=evaluation)
103
+
104
+ # Assert form is valid, but locked questionnaire is not added
105
+ form.save()
106
+ self.assertEqual({questionnaire}, set(evaluation.general_contribution.questionnaires.all()))
107
+
108
+ evaluation.general_contribution.questionnaires.add(locked_questionnaire)
109
+
110
+ form_data = get_form_data_from_instance(EvaluationForm, evaluation)
111
+ form_data["general_questionnaires"] = [questionnaire.pk] # remove locked questionnaire
112
+
113
+ form = EvaluationForm(form_data, instance=evaluation)
114
+
115
+ # Assert form is valid, but locked questionnaire is not removed
116
+ form.save()
117
+ self.assertEqual(
118
+ {questionnaire, locked_questionnaire}, set(evaluation.general_contribution.questionnaires.all())
119
+ )
120
+
121
+ def test_existing_contributors_are_in_queryset(self):
122
+ """
123
+ Asserts that users that should normally not be in the contributor queryset are in it when they are already set.
124
+ Regression test for #1414.
125
+ """
126
+ evaluation = baker.make(Evaluation)
127
+ non_proxy_user = baker.make(UserProfile)
128
+ proxy_user = baker.make(UserProfile, is_proxy_user=True)
129
+ contribution1 = baker.make(Contribution, evaluation=evaluation, contributor=non_proxy_user, questionnaires=[])
130
+
131
+ InlineContributionFormset = inlineformset_factory(
132
+ Evaluation, Contribution, formset=ContributionFormset, form=EditorContributionForm, extra=1
133
+ )
134
+ formset = InlineContributionFormset(instance=evaluation, form_kwargs={"evaluation": evaluation})
135
+
136
+ self.assertEqual({non_proxy_user}, set(formset.forms[0].fields["contributor"].queryset))
137
+
138
+ # now a manager adds the proxy user as a contributor.
139
+ contribution1.contributor = proxy_user
140
+ contribution1.save()
141
+
142
+ InlineContributionFormset = inlineformset_factory(
143
+ Evaluation, Contribution, formset=ContributionFormset, form=EditorContributionForm, extra=1
144
+ )
145
+ formset = InlineContributionFormset(instance=evaluation, form_kwargs={"evaluation": evaluation})
146
+
147
+ self.assertEqual({proxy_user, non_proxy_user}, set(formset.forms[0].fields["contributor"].queryset))
148
+
149
+
150
+ class ContributionFormsetWebTests(WebTest):
151
+ csrf_checks = False
152
+
153
+ def test_form_ordering(self):
154
+ """
155
+ Asserts that the contribution formset is correctly sorted,
156
+ and that an ordering changed by the user survives the reload
157
+ when the user submits the form with errors.
158
+ Regression test for #456.
159
+ """
160
+ evaluation = baker.make(Evaluation, state=Evaluation.State.PREPARED)
161
+ user1 = baker.make(UserProfile, email="user1@institution.example.com")
162
+ user2 = baker.make(UserProfile, email="user2@institution.example.com")
163
+ questionnaire = baker.make(Questionnaire, type=Questionnaire.Type.CONTRIBUTOR)
164
+ contribution1 = baker.make(
165
+ Contribution,
166
+ evaluation=evaluation,
167
+ contributor=user1,
168
+ role=Contribution.Role.EDITOR,
169
+ textanswer_visibility=Contribution.TextAnswerVisibility.GENERAL_TEXTANSWERS,
170
+ questionnaires=[questionnaire],
171
+ order=1,
172
+ )
173
+ contribution2 = baker.make(
174
+ Contribution,
175
+ evaluation=evaluation,
176
+ contributor=user2,
177
+ role=Contribution.Role.EDITOR,
178
+ textanswer_visibility=Contribution.TextAnswerVisibility.GENERAL_TEXTANSWERS,
179
+ questionnaires=[questionnaire],
180
+ order=2,
181
+ )
182
+
183
+ # almost everything is missing in this set of data,
184
+ # so we're guaranteed to have some errors
185
+ data = {
186
+ "contributions-TOTAL_FORMS": 2,
187
+ "contributions-INITIAL_FORMS": 2,
188
+ "contributions-MIN_NUM_FORMS": 0,
189
+ "contributions-MAX_NUM_FORMS": 1000,
190
+ "contributions-0-id": contribution1.id,
191
+ "contributions-1-id": contribution2.id,
192
+ "operation": "save",
193
+ }
194
+
195
+ data["contributions-0-order"] = 1
196
+ data["contributions-1-order"] = 2
197
+ response = str(self.app.post(f"/contributor/evaluation/{evaluation.pk}/edit", params=data, user=user1))
198
+ self.assertTrue(response.index("id_contributions-1-id") > response.index("id_contributions-0-id"))
199
+
200
+ data["contributions-0-order"] = 2
201
+ data["contributions-1-order"] = 1
202
+ response = str(self.app.post(f"/contributor/evaluation/{evaluation.pk}/edit", params=data, user=user1))
203
+ self.assertFalse(response.index("id_contributions-1-id") > response.index("id_contributions-0-id"))
@@ -0,0 +1,287 @@
1
+ import xlrd
2
+ from django.core import mail
3
+ from django.urls import reverse
4
+ from model_bakery import baker
5
+
6
+ from evap.evaluation.models import Contribution, Course, Evaluation, Questionnaire, UserProfile
7
+ from evap.evaluation.tests.tools import (
8
+ WebTest,
9
+ WebTestWith200Check,
10
+ create_evaluation_with_responsible_and_editor,
11
+ submit_with_modal,
12
+ )
13
+
14
+
15
+ class TestContributorDirectDelegationView(WebTest):
16
+ csrf_checks = False
17
+
18
+ @classmethod
19
+ def setUpTestData(cls):
20
+ cls.evaluation = baker.make(Evaluation, state=Evaluation.State.PREPARED)
21
+
22
+ cls.editor = baker.make(UserProfile, email="editor@institution.example.com")
23
+ cls.non_editor = baker.make(UserProfile, email="non_editor@institution.example.com")
24
+ baker.make(
25
+ Contribution,
26
+ evaluation=cls.evaluation,
27
+ contributor=cls.editor,
28
+ role=Contribution.Role.EDITOR,
29
+ textanswer_visibility=Contribution.TextAnswerVisibility.GENERAL_TEXTANSWERS,
30
+ )
31
+
32
+ def test_direct_delegation_request(self):
33
+ data = {"delegate_to": self.non_editor.id}
34
+ page = self.app.post(
35
+ f"/contributor/evaluation/{self.evaluation.id}/direct_delegation",
36
+ params=data,
37
+ user=self.editor,
38
+ ).follow()
39
+
40
+ self.assertContains(
41
+ page,
42
+ f"{self.non_editor} was added as a contributor for evaluation "{self.evaluation}" and was sent an email with further information.",
43
+ )
44
+
45
+ contribution = Contribution.objects.get(contributor=self.non_editor)
46
+ self.assertEqual(contribution.role, Contribution.Role.EDITOR)
47
+
48
+ self.assertEqual(len(mail.outbox), 1)
49
+
50
+ def test_direct_delegation_request_with_existing_contribution(self):
51
+ contribution = baker.make(
52
+ Contribution,
53
+ evaluation=self.evaluation,
54
+ contributor=self.non_editor,
55
+ role=Contribution.Role.CONTRIBUTOR,
56
+ )
57
+ old_contribution_count = Contribution.objects.count()
58
+
59
+ data = {"delegate_to": self.non_editor.id}
60
+ page = self.app.post(
61
+ f"/contributor/evaluation/{self.evaluation.id}/direct_delegation",
62
+ params=data,
63
+ user=self.editor,
64
+ ).follow()
65
+
66
+ self.assertContains(
67
+ page,
68
+ f"{self.non_editor} was added as a contributor for evaluation "{self.evaluation}" and was sent an email with further information.",
69
+ )
70
+
71
+ self.assertEqual(Contribution.objects.count(), old_contribution_count)
72
+
73
+ contribution.refresh_from_db()
74
+ self.assertEqual(contribution.role, Contribution.Role.EDITOR)
75
+
76
+ self.assertEqual(len(mail.outbox), 1)
77
+
78
+
79
+ class TestContributorView(WebTestWith200Check):
80
+ url = "/contributor/"
81
+
82
+ @classmethod
83
+ def setUpTestData(cls):
84
+ users = create_evaluation_with_responsible_and_editor()
85
+ cls.test_users = [users["editor"], users["responsible"]]
86
+
87
+
88
+ class TestContributorEvaluationView(WebTestWith200Check):
89
+ @classmethod
90
+ def setUpTestData(cls):
91
+ result = create_evaluation_with_responsible_and_editor()
92
+ cls.responsible = result["responsible"]
93
+ cls.editor = result["editor"]
94
+ cls.evaluation = result["evaluation"]
95
+
96
+ cls.test_users = [cls.editor, cls.responsible]
97
+ cls.url = f"/contributor/evaluation/{cls.evaluation.pk}"
98
+
99
+ def test_wrong_state(self):
100
+ self.evaluation.reset_to_new(delete_previous_answers=False)
101
+ self.evaluation.save()
102
+ self.app.get(self.url, user=self.responsible, status=403)
103
+
104
+ def test_information_message(self):
105
+ self.evaluation.editor_approve()
106
+ self.evaluation.save()
107
+
108
+ page = self.app.get(self.url, user=self.editor)
109
+ self.assertContains(page, "You cannot edit this evaluation because it has already been approved")
110
+ self.assertNotContains(
111
+ page,
112
+ "Please review the evaluation's details below, add all contributors and select suitable questionnaires. "
113
+ "Once everything is okay, please approve the evaluation on the bottom of the page.",
114
+ )
115
+
116
+
117
+ class TestContributorEvaluationPreviewView(WebTestWith200Check):
118
+ @classmethod
119
+ def setUpTestData(cls):
120
+ result = create_evaluation_with_responsible_and_editor()
121
+ cls.responsible = result["responsible"]
122
+ cls.test_users = [result["editor"], result["responsible"]]
123
+ cls.evaluation = result["evaluation"]
124
+ cls.url = f"/contributor/evaluation/{cls.evaluation.pk}/preview"
125
+
126
+ def test_wrong_state(self):
127
+ self.evaluation.reset_to_new(delete_previous_answers=False)
128
+ self.evaluation.save()
129
+ self.app.get(self.url, user=self.responsible, status=403)
130
+
131
+ def test_without_questionnaires_assigned(self):
132
+ # regression test for #1747
133
+ self.evaluation.general_contribution.questionnaires.set([])
134
+ self.app.get(self.url, user=self.responsible, status=200)
135
+
136
+
137
+ class TestContributorEvaluationEditView(WebTest):
138
+ @classmethod
139
+ def setUpTestData(cls):
140
+ result = create_evaluation_with_responsible_and_editor()
141
+ cls.responsible = result["responsible"]
142
+ cls.editor = result["editor"]
143
+ cls.evaluation = result["evaluation"]
144
+ cls.url = f"/contributor/evaluation/{cls.evaluation.pk}/edit"
145
+
146
+ def test_not_authenticated(self):
147
+ """
148
+ Asserts that an unauthorized user gets redirected to the login page.
149
+ """
150
+ response = self.app.get(self.url)
151
+ self.assertRedirects(response, f"/?next=/contributor/evaluation/{self.evaluation.pk}/edit")
152
+
153
+ def test_wrong_usergroup(self):
154
+ """
155
+ Asserts that a user who is not part of the usergroup
156
+ that is required for a specific view gets a 403.
157
+ Regression test for #483
158
+ """
159
+ self.app.get(self.url, user="student@institution.example.com", status=403)
160
+
161
+ def test_wrong_state(self):
162
+ """
163
+ Asserts that a contributor attempting to edit an evaluation
164
+ that is in a state where editing is not allowed gets a 403.
165
+ """
166
+ self.evaluation.editor_approve()
167
+ self.evaluation.save()
168
+
169
+ self.app.get(self.url, user=self.responsible, status=403)
170
+
171
+ def test_contributor_evaluation_edit(self):
172
+ """
173
+ Tests whether the "save" button in the contributor's evaluation edit view does not
174
+ change the evaluation's state, and that the "approve" button does that.
175
+ """
176
+ page = self.app.get(self.url, user=self.responsible, status=200)
177
+ form = page.forms["evaluation-form"]
178
+ form["vote_start_datetime"] = "2098-01-01 11:43:12"
179
+ form["vote_end_date"] = "2099-01-01"
180
+
181
+ form.submit(name="operation", value="save")
182
+ self.evaluation = Evaluation.objects.get(pk=self.evaluation.pk)
183
+ self.assertEqual(self.evaluation.state, Evaluation.State.PREPARED)
184
+
185
+ submit_with_modal(page, form, name="operation", value="approve")
186
+ self.evaluation = Evaluation.objects.get(pk=self.evaluation.pk)
187
+ self.assertEqual(self.evaluation.state, Evaluation.State.EDITOR_APPROVED)
188
+
189
+ # test what happens if the operation is not specified correctly
190
+ form.submit(status=403)
191
+
192
+ def test_single_locked_questionnaire(self):
193
+ locked_questionnaire = baker.make(
194
+ Questionnaire,
195
+ type=Questionnaire.Type.TOP,
196
+ is_locked=True,
197
+ visibility=Questionnaire.Visibility.EDITORS,
198
+ )
199
+ responsible = UserProfile.objects.get(email="responsible@institution.example.com")
200
+ evaluation = baker.make(
201
+ Evaluation,
202
+ course=baker.make(Course, responsibles=[responsible]),
203
+ state=Evaluation.State.PREPARED,
204
+ )
205
+ evaluation.general_contribution.questionnaires.set([locked_questionnaire])
206
+
207
+ page = self.app.get(f"/contributor/evaluation/{evaluation.pk}/edit", user=responsible, status=200)
208
+ form = page.forms["evaluation-form"]
209
+
210
+ # see https://github.com/Pylons/webtest/issues/138
211
+ for name_field_tuple in form.field_order[:]:
212
+ if "disabled" in name_field_tuple[1].attrs:
213
+ form.field_order.remove(name_field_tuple)
214
+
215
+ response = form.submit(name="operation", value="save")
216
+ self.assertIn("Successfully updated evaluation", response.follow())
217
+
218
+ def test_contributor_evaluation_edit_preview(self):
219
+ """
220
+ Asserts that the preview button either renders a preview or shows an error.
221
+ """
222
+ page = self.app.get(self.url, user=self.responsible)
223
+ form = page.forms["evaluation-form"]
224
+ form["vote_start_datetime"] = "2099-01-01 11:43:12"
225
+ form["vote_end_date"] = "2098-01-01"
226
+
227
+ response = form.submit(name="operation", value="preview")
228
+ self.assertNotIn("previewModal", response)
229
+ self.assertIn("The preview could not be rendered", response)
230
+
231
+ form["vote_start_datetime"] = "2098-01-01 11:43:12"
232
+ form["vote_end_date"] = "2099-01-01"
233
+
234
+ response = form.submit(name="operation", value="preview")
235
+ self.assertIn("previewModal", response)
236
+ self.assertNotIn("The preview could not be rendered", response)
237
+
238
+ def test_contact_modal_escape(self):
239
+ """
240
+ Asserts that the evaluation title is correctly escaped in the contact modal.
241
+ Regression test for #1060
242
+ """
243
+ self.evaluation.name_en = "Adam & Eve"
244
+ self.evaluation.save()
245
+ page = self.app.get(self.url, user=self.responsible, status=200)
246
+
247
+ self.assertIn("changeEvaluationRequestModalLabel", page)
248
+
249
+ self.assertNotIn("Adam & Eve", page)
250
+ self.assertIn("Adam & Eve", page)
251
+ self.assertNotIn("Adam & Eve", page)
252
+
253
+ def test_information_message(self):
254
+ page = self.app.get(self.url, user=self.editor)
255
+ self.assertNotContains(page, "You cannot edit this evaluation because it has already been approved")
256
+ self.assertContains(
257
+ page,
258
+ "Please review the evaluation's details below, add all contributors and select suitable questionnaires. "
259
+ "Once everything is okay, please approve the evaluation on the bottom of the page.",
260
+ )
261
+
262
+ def test_display_request_buttons(self):
263
+ self.evaluation.allow_editors_to_edit = False
264
+ self.evaluation.save()
265
+ page = self.app.get(self.url, user=self.responsible)
266
+ self.assertEqual(page.body.decode().count("Request changes"), 1)
267
+ self.assertEqual(page.body.decode().count("Request creation of new account"), 1)
268
+
269
+ self.evaluation.allow_editors_to_edit = True
270
+ self.evaluation.save()
271
+ page = self.app.get(self.url, user=self.responsible)
272
+ self.assertEqual(page.body.decode().count("Request changes"), 0)
273
+ self.assertEqual(page.body.decode().count("Request creation of new account"), 2)
274
+
275
+
276
+ class TestContributorResultsExportView(WebTest):
277
+ @classmethod
278
+ def setUpTestData(cls):
279
+ result = create_evaluation_with_responsible_and_editor()
280
+ cls.url = reverse("contributor:export")
281
+ cls.user = result["responsible"]
282
+
283
+ def test_concise_header(self):
284
+ response = self.app.get(self.url, user=self.user)
285
+
286
+ workbook = xlrd.open_workbook(file_contents=response.content)
287
+ self.assertEqual(workbook.sheets()[0].row_values(0)[0], f"Evaluation\n{self.user.full_name}")
@@ -0,0 +1,14 @@
1
+ from django.urls import path
2
+
3
+ from evap.contributor import views
4
+
5
+ app_name = "contributor"
6
+
7
+ urlpatterns = [
8
+ path("", views.index, name="index"),
9
+ path("export", views.export, name="export"),
10
+ path("evaluation/<int:evaluation_id>", views.evaluation_view, name="evaluation_view"),
11
+ path("evaluation/<int:evaluation_id>/edit", views.evaluation_edit, name="evaluation_edit"),
12
+ path("evaluation/<int:evaluation_id>/preview", views.evaluation_preview, name="evaluation_preview"),
13
+ path("evaluation/<int:evaluation_id>/direct_delegation", views.evaluation_direct_delegation, name="evaluation_direct_delegation")
14
+ ]