prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  there is duplicated code in EvaP
  while browsing the code, i ran across a lot of structurally very similar blocks of code. 
  
  this is a reminder for me to search for these code parts, collect a few, and find the cause and solutions for them.
  
  examples: 
  - [x] https://github.com/fsr-itse/EvaP/commit/ca4b28a6054944859ec4447fff95fc36095a2ffb.
  - [x] the contributor course view/template vs the fsr course view/template.
  - [x] student_index and contributor_index (html and view)
  - [ ] fsr_import and user_import
  - [x] the multiselect initialization inside the script blocks exists multiple times in different files. one can find it by searching for select[multiple='multiple']
  - [x] https://github.com/janno42/EvaP/blob/reward_points/evap/fsr/templates/fsr_reward_point_redemption_event_delete.html
  - [x] search for $(".twipsify") and $("input[data-datepicker='datepicker']:not([readonly='True'])")
  - [x] sortable and apply_ordering functions
  - [x] if ($.fn.button.noConflict != undefined)
  - [x] $('#id_degree').combobox() and similar
  - [x] fsr_course_preview.html, fsr_questionnaire_view.html, contributor_course_preview.html
  - [x] javascript-code of the sortable forms: [contributor/staff]_course_form.html (or rather, evap_course_edit_js.html), staff_faq_index.html and staff_faq_section.html
  - [x] all the leave.js occurrences
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `evap/evaluation/management/commands/merge_users.py`
  Content:
  ```
  1 from django.core.management.base import BaseCommand
  2 
  3 from evap.evaluation.models import UserProfile
  4 from evap.evaluation.merge import merge_model_objects
  5 
  6 
  7 class Command(BaseCommand):
  8     args = '<user ID 1> <user ID 2>'
  9     help = 'Merge two users'
  10 
  11     def handle(self, *args, **options):
  12         try:
  13             user1 = UserProfile.objects.get(pk=int(args[0]))
  14             user2 = UserProfile.objects.get(pk=int(args[1]))
  15 
  16             print("Merging user '{1}' into user '{0}'".format(user1, user2))
  17             merge_model_objects(user1, user2)
  18         except Exception:
  19             import traceback
  20             traceback.print_exc()
  21
  ```
  
  Path: `evap/staff/templatetags/staff_templatetags.py`
  Content:
  ```
  1 from django.template import Library
  2 
  3 from evap.evaluation.models import Semester
  4 
  5 register = Library()
  6 
  7 
  8 @register.inclusion_tag("staff_semester_menu.html")
  9 def include_staff_semester_menu():
  10     return dict(semesters=Semester.objects.all()[:5])
  11 
  12 @register.inclusion_tag('staff_course_selection_list.html')
  13 def include_staff_course_selection_list(course_forms, btn_label, empty_msg):
  14     return {
  15         'course_forms': course_forms,
  16         'btn_label':    btn_label,
  17         'empty_msg':    empty_msg
  18     }
  19 
  20 @register.inclusion_tag('staff_user_labels.html')
  21 def include_staff_user_labels(user):
  22     return dict(user=user)
  23
  ```
  
  Path: `evap/evaluation/templatetags/evaluation_templatetags.py`
  Content:
  ```
  1 from django.template import Library
  2 from evap.evaluation.models import Semester
  3 
  4 register = Library()
  5 
  6 
  7 @register.inclusion_tag("user_list_with_links.html")
  8 def include_user_list_with_links(users):
  9     return dict(users=users)
  10
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/evap/evaluation/management/commands/merge_users.py b/evap/evaluation/management/commands/merge_users.py
  --- a/evap/evaluation/management/commands/merge_users.py
  +++ b/evap/evaluation/management/commands/merge_users.py
  @@ -5,8 +5,8 @@
   
   
   class Command(BaseCommand):
  -    args = '<user ID 1> <user ID 2>'
  -    help = 'Merge two users'
  +    args = '<primary user ID> <duplicate user ID>'
  +    help = 'Merges duplicate user into primary user'
   
       def handle(self, *args, **options):
           try:
  diff --git a/evap/evaluation/templatetags/evaluation_templatetags.py b/evap/evaluation/templatetags/evaluation_templatetags.py
  --- a/evap/evaluation/templatetags/evaluation_templatetags.py
  +++ b/evap/evaluation/templatetags/evaluation_templatetags.py
  @@ -7,3 +7,9 @@
   @register.inclusion_tag("user_list_with_links.html")
   def include_user_list_with_links(users):
       return dict(users=users)
  +
  +
  +@register.inclusion_tag("sortable_form_js.html")
  +def include_sortable_form_js():
  +    return dict()
  +
  diff --git a/evap/staff/templatetags/staff_templatetags.py b/evap/staff/templatetags/staff_templatetags.py
  --- a/evap/staff/templatetags/staff_templatetags.py
  +++ b/evap/staff/templatetags/staff_templatetags.py
  @@ -20,3 +20,7 @@
   @register.inclusion_tag('staff_user_labels.html')
   def include_staff_user_labels(user):
       return dict(user=user)
  +
  +@register.inclusion_tag("staff_questionnaire_index_list.html")
  +def include_staff_questionnaire_index_list(questionnaires, headline):
  +    return dict(questionnaires=questionnaires, headline=headline)
  
verification_info: {"golden_diff": "diff --git a/evap/evaluation/management/commands/merge_users.py b/evap/evaluation/management/commands/merge_users.py\n--- a/evap/evaluation/management/commands/merge_users.py\n+++ b/evap/evaluation/management/commands/merge_users.py\n@@ -5,8 +5,8 @@\n \n \n class Command(BaseCommand):\n-    args = '<user ID 1> <user ID 2>'\n-    help = 'Merge two users'\n+    args = '<primary user ID> <duplicate user ID>'\n+    help = 'Merges duplicate user into primary user'\n \n     def handle(self, *args, **options):\n         try:\ndiff --git a/evap/evaluation/templatetags/evaluation_templatetags.py b/evap/evaluation/templatetags/evaluation_templatetags.py\n--- a/evap/evaluation/templatetags/evaluation_templatetags.py\n+++ b/evap/evaluation/templatetags/evaluation_templatetags.py\n@@ -7,3 +7,9 @@\n @register.inclusion_tag(\"user_list_with_links.html\")\n def include_user_list_with_links(users):\n     return dict(users=users)\n+\n+\n+@register.inclusion_tag(\"sortable_form_js.html\")\n+def include_sortable_form_js():\n+    return dict()\n+\ndiff --git a/evap/staff/templatetags/staff_templatetags.py b/evap/staff/templatetags/staff_templatetags.py\n--- a/evap/staff/templatetags/staff_templatetags.py\n+++ b/evap/staff/templatetags/staff_templatetags.py\n@@ -20,3 +20,7 @@\n @register.inclusion_tag('staff_user_labels.html')\n def include_staff_user_labels(user):\n     return dict(user=user)\n+\n+@register.inclusion_tag(\"staff_questionnaire_index_list.html\")\n+def include_staff_questionnaire_index_list(questionnaires, headline):\n+    return dict(questionnaires=questionnaires, headline=headline)\n", "issue": "there is duplicated code in EvaP\nwhile browsing the code, i ran across a lot of structurally very similar blocks of code. \n\nthis is a reminder for me to search for these code parts, collect a few, and find the cause and solutions for them.\n\nexamples: \n- [x] https://github.com/fsr-itse/EvaP/commit/ca4b28a6054944859ec4447fff95fc36095a2ffb.\n- [x] the contributor course view/template vs the fsr course view/template.\n- [x] student_index and contributor_index (html and view)\n- [ ] fsr_import and user_import\n- [x] the multiselect initialization inside the script blocks exists multiple times in different files. one can find it by searching for select[multiple='multiple']\n- [x] https://github.com/janno42/EvaP/blob/reward_points/evap/fsr/templates/fsr_reward_point_redemption_event_delete.html\n- [x] search for $(\".twipsify\") and $(\"input[data-datepicker='datepicker']:not([readonly='True'])\")\n- [x] sortable and apply_ordering functions\n- [x] if ($.fn.button.noConflict != undefined)\n- [x] $('#id_degree').combobox() and similar\n- [x] fsr_course_preview.html, fsr_questionnaire_view.html, contributor_course_preview.html\n- [x] javascript-code of the sortable forms: [contributor/staff]_course_form.html (or rather, evap_course_edit_js.html), staff_faq_index.html and staff_faq_section.html\n- [x] all the leave.js occurrences\n\n", "before_files": [{"content": "from django.core.management.base import BaseCommand\n\nfrom evap.evaluation.models import UserProfile\nfrom evap.evaluation.merge import merge_model_objects\n\n\nclass Command(BaseCommand):\n    args = '<user ID 1> <user ID 2>'\n    help = 'Merge two users'\n\n    def handle(self, *args, **options):\n        try:\n            user1 = UserProfile.objects.get(pk=int(args[0]))\n            user2 = UserProfile.objects.get(pk=int(args[1]))\n\n            print(\"Merging user '{1}' into user '{0}'\".format(user1, user2))\n            merge_model_objects(user1, user2)\n        except Exception:\n            import traceback\n            traceback.print_exc()\n", "path": "evap/evaluation/management/commands/merge_users.py"}, {"content": "from django.template import Library\n\nfrom evap.evaluation.models import Semester\n\nregister = Library()\n\n\n@register.inclusion_tag(\"staff_semester_menu.html\")\ndef include_staff_semester_menu():\n    return dict(semesters=Semester.objects.all()[:5])\n\n@register.inclusion_tag('staff_course_selection_list.html')\ndef include_staff_course_selection_list(course_forms, btn_label, empty_msg):\n    return {\n        'course_forms': course_forms,\n        'btn_label':    btn_label,\n        'empty_msg':    empty_msg\n    }\n\n@register.inclusion_tag('staff_user_labels.html')\ndef include_staff_user_labels(user):\n    return dict(user=user)\n", "path": "evap/staff/templatetags/staff_templatetags.py"}, {"content": "from django.template import Library\nfrom evap.evaluation.models import Semester\n\nregister = Library()\n\n\n@register.inclusion_tag(\"user_list_with_links.html\")\ndef include_user_list_with_links(users):\n    return dict(users=users)\n", "path": "evap/evaluation/templatetags/evaluation_templatetags.py"}], "after_files": [{"content": "from django.core.management.base import BaseCommand\n\nfrom evap.evaluation.models import UserProfile\nfrom evap.evaluation.merge import merge_model_objects\n\n\nclass Command(BaseCommand):\n    args = '<primary user ID> <duplicate user ID>'\n    help = 'Merges duplicate user into primary user'\n\n    def handle(self, *args, **options):\n        try:\n            user1 = UserProfile.objects.get(pk=int(args[0]))\n            user2 = UserProfile.objects.get(pk=int(args[1]))\n\n            print(\"Merging user '{1}' into user '{0}'\".format(user1, user2))\n            merge_model_objects(user1, user2)\n        except Exception:\n            import traceback\n            traceback.print_exc()\n", "path": "evap/evaluation/management/commands/merge_users.py"}, {"content": "from django.template import Library\n\nfrom evap.evaluation.models import Semester\n\nregister = Library()\n\n\n@register.inclusion_tag(\"staff_semester_menu.html\")\ndef include_staff_semester_menu():\n    return dict(semesters=Semester.objects.all()[:5])\n\n@register.inclusion_tag('staff_course_selection_list.html')\ndef include_staff_course_selection_list(course_forms, btn_label, empty_msg):\n    return {\n        'course_forms': course_forms,\n        'btn_label':    btn_label,\n        'empty_msg':    empty_msg\n    }\n\n@register.inclusion_tag('staff_user_labels.html')\ndef include_staff_user_labels(user):\n    return dict(user=user)\n\n@register.inclusion_tag(\"staff_questionnaire_index_list.html\")\ndef include_staff_questionnaire_index_list(questionnaires, headline):\n    return dict(questionnaires=questionnaires, headline=headline)\n", "path": "evap/staff/templatetags/staff_templatetags.py"}, {"content": "from django.template import Library\nfrom evap.evaluation.models import Semester\n\nregister = Library()\n\n\n@register.inclusion_tag(\"user_list_with_links.html\")\ndef include_user_list_with_links(users):\n    return dict(users=users)\n\n\n@register.inclusion_tag(\"sortable_form_js.html\")\ndef include_sortable_form_js():\n    return dict()\n\n", "path": "evap/evaluation/templatetags/evaluation_templatetags.py"}]}