Skip to content

Fix Question and Question Dependency Creation Error (500) and Restore Question Management Functionality in Tickets Component #1032

@mariobehling

Description

@mariobehling

Currently, in the Tickets component, organizers cannot create new questions or question dependencies.
Attempting to create or save a new question results in a 500 Internal Server Error.

The system is intended to allow organizers to create both:

  1. Standalone questions (e.g., text, choice, checkbox, etc.)
  2. Dependent questions (questions that only appear when a specific answer to another question is selected).

This feature previously allowed flexible attendee data collection and is critical for registration and order customization.

Expected Behavior

Organizers should be able to:

  • Create and edit questions under Event → Settings → Questions.
  • Define a parent question and dependency conditions (for example, show “Meal preference” only if “Meals included” = Yes).
  • Save questions and dependencies successfully without a 500 error.
  • See dependent questions appear dynamically in the order or registration form when the condition is met.

Steps to Reproduce

  1. Log in as an Organizer or Admin.

  2. Go to:

    /control/event/<orgname>/<eventslug>/questions/
    
  3. Click Create Question.

  4. Fill out required fields such as:

    • Question text
    • Type (choice, text, boolean, etc.)
    • Target (per-order or per-attendee)
  5. Click Save → Observe:
    Result: 500 Internal Server Error appears.

  6. When attempting to create a dependent question:

    • Create a base question (e.g., “Do you need accommodation?” → type: yes/no).
    • Then create a second question (e.g., “Preferred room type”) and choose the first question as the dependency.
    • Select dependency condition (e.g., show only if answer = “Yes”).
    • Click Save500 error appears again.

Expected Result

  • Question creation and editing work without error.
  • Dependencies between questions can be defined and saved.
  • Dependent questions appear dynamically on the order form according to their parent question’s answer.

Technical Notes

  • Investigate error source in the question creation or dependency save view:
    Likely file:

    app/eventyay/base/views/questions.py
    

    or similar Django view handling QuestionForm and QuestionDependencyForm.

  • Check related models:

    • Question
    • QuestionDependency
    • Any associated Choice or QuestionOption models.
  • Verify form and template logic for dependencies:

    • Confirm that the parent question dropdown correctly loads existing questions.
    • Ensure dependency values are passed and validated properly.
    • Check form POST handling and validation errors are caught instead of raising 500s.
  • Verify migrations and database constraints for:

    • Nullability of dependency fields.
    • Integrity constraints between question IDs.
  • Implement front-end rendering logic for conditional questions using existing JavaScript (or re-enable the logic if disabled).

Testing Instructions

1. Test Creating a Question (no dependency):

  • Navigate to the event’s question settings page.

  • Click Create Question.

  • Enter:

    • Text: “Do you require special assistance?”
    • Type: Boolean (Yes/No).
    • Target: Attendee.
  • Save.

  • Confirm it appears in the list of questions and on the attendee registration form.

2. Test Creating a Dependent Question:

  • Create a new question:

    • Text: “Please specify your accessibility needs.”
    • Type: Text.
    • Set dependency: Show only if “Do you require special assistance?” = “Yes”.
  • Save.

  • On the registration page:

    • Select “Yes” to the first question → the dependent question appears.
    • Select “No” → dependent question remains hidden.

3. Test Editing Existing Questions:

  • Edit both types of questions, update text, and confirm changes save without errors.

4. Test Deletion and Validation:

  • Delete a dependent question and confirm the parent question remains valid.
  • Delete a parent question and verify the system correctly deletes or disables related dependencies.

Acceptance Criteria

  • Creating a question no longer results in a 500 error.
  • Dependent questions can be created and saved correctly.
  • Dependencies behave correctly on registration and order forms.
  • Validation errors are shown to the user (not 500).
  • All CRUD operations (create, edit, delete) work for both questions and dependencies.
  • Automated tests for question creation, dependency creation, and conditional rendering are added.

Related Areas

  • Question and QuestionDependency models
  • Admin and organizer question management pages
  • Registration and attendee form rendering logic
Image

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions