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

Fix manual challenge create #91

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Fix manual challenge create #91

merged 1 commit into from
Jul 5, 2023

Conversation

col3zy
Copy link
Contributor

@col3zy col3zy commented Jul 5, 2023

When attempting to manually create a challenge the user is presented with a form consisting of:

  • Name
  • Points
  • Category
  • Description

On submit the api returns:
"Error: note_id. This field is required"
There is no option for the user to supply a note_id.

This is a validation error. note_id has a default which will be used for new challenges.

This PR removes note_id from the validation for ChallengeCreateForm.

Remove note_id validation from ChallengeCreateForm. note_id is created automatically on challenge create, not by the user.
@col3zy
Copy link
Contributor Author

col3zy commented Jul 5, 2023

image

@DaniloNC
Copy link
Contributor

DaniloNC commented Jul 5, 2023

It sounds like the new form check on template is false, even on new challenges.
I cannot see the HedgeDoc ID label in the html on a new challenge creation.

The note_id input is after the HedgeDoc ID.

{% if form.instance.creation_time %}
<label class="label"><strong>HedgeDoc ID </strong></label>
<div class="input-group mb-3">
<span class="input-group-text">
<i class="fab fa-markdown"></i>
</span>
<input id="{{ form.note_id.id_for_label }}" name="{{ form.note_id.html_name }}"
placeholder="{{ form.note_id.label }}" value="{{ form.note_id.value }}"
class="form-control" type="text" readonly>
</div>

@DaniloNC
Copy link
Contributor

DaniloNC commented Jul 5, 2023

note_id not present during new challenge creation:

image

image

@col3zy
Copy link
Contributor Author

col3zy commented Jul 5, 2023

Correct. It's only an option when editing an existing challenge (challenge.creation_time != null). Yet it's considered a mandatory field.

@hugsy hugsy merged commit 6f423e0 into hugsy:main Jul 5, 2023
hugsy pushed a commit that referenced this pull request Jul 5, 2023
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.

3 participants