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

💻 Unsubmit program #5304

Merged
merged 21 commits into from
Mar 27, 2024
Merged

💻 Unsubmit program #5304

merged 21 commits into from
Mar 27, 2024

Conversation

Annelein
Copy link
Collaborator

@Annelein Annelein commented Mar 25, 2024

Fixes #4634

How to test:

  1. Log in as a student in a teachers class
  2. Create a program and submit it
  3. Log in as the teacher
  4. Go to the class the student is in click: overview of programs per adventure, open the submitted program
  5. Click on the unsubmit button
Screen.Recording.2024-03-25.at.12.24.39.mov

website/database.py Outdated Show resolved Hide resolved
website/programs.py Outdated Show resolved Hide resolved
templates/view-program-page.html Outdated Show resolved Hide resolved
@hedyorg hedyorg deleted a comment from hasan-sh Mar 26, 2024
@Annelein Annelein requested a review from hasan-sh March 27, 2024 09:02
Copy link
Collaborator

@hasan-sh hasan-sh left a comment

Choose a reason for hiding this comment

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

Great thanks:) Only these two tiny things, and we're good to roll!

@@ -7,6 +7,11 @@
<h2>{{_('submitted_header')}}</h2>
<h3 class="inline-block mt-0">{{_('submission_time')}}: {{program_timestamp}}</h3>
</div>
{% if is_teacher %}
<div class="text-center">
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.modal.confirm ('{{_('unsubmit_warning')}}', function () {hedyApp.unsubmit_program ('{{initial_adventure.id}}', {{ loop_index }})})">{{_('unsubmit_program')}}</button>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.modal.confirm ('{{_('unsubmit_warning')}}', function () {hedyApp.unsubmit_program ('{{initial_adventure.id}}', {{ loop_index }})})">{{_('unsubmit_program')}}</button>
<button class="green-btn" data-cy="unsubmit-btn" onclick="hedyApp.unsubmit_program ('{{initial_adventure.id}}', '{{_('unsubmit_warning')}}'))">{{_('unsubmit_program')}}</button>

Either do this and handle the model in the backend, or convert it to htmx as we usually do!

@@ -292,12 +292,12 @@ def set_program_public_by_id(self, id, public):
"""
return PROGRAMS.update({"id": id}, {"public": 1 if public else 0})

def submit_program_by_id(self, id):
def submit_program_by_id(self, id, submit):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps change the name of the fuction to reflect what it's really doing?

Copy link
Contributor

mergify bot commented Mar 27, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 7d4e7c3 into main Mar 27, 2024
12 checks passed
@mergify mergify bot deleted the unsubmit-program branch March 27, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[UI idea] Teachers should be allowed to "unsubmit" a student's program
2 participants