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

Error during validation of event type length #3137

Open
1 of 2 tasks
AndrewKvalheim opened this issue Mar 10, 2023 · 2 comments
Open
1 of 2 tasks

Error during validation of event type length #3137

AndrewKvalheim opened this issue Mar 10, 2023 · 2 comments
Labels
bug 🐛 Something is wrong and needs to be fixed

Comments

@AndrewKvalheim
Copy link
Member

AndrewKvalheim commented Mar 10, 2023

I'm submitting a…

  • Bug Report
  • Feature Request

Current behavior

When editing an event type, it’s possible to blank the length field:

screenshot

This triggers a server error during validation:

Started PATCH "/admin/conferences/example/program/event_types/1"
Processing by Admin::EventTypesController#update as HTML
  Parameters: {"authenticity_token"=>"[FILTERED]", "event_type"=>{"title"=>"Talk", "length"=>"", "description"=>"Presentation in lecture format", "minimum_abstract_length"=>"0", "maximum_abstract_length"=>"500", "color"=>"#ff0000"}, "commit"=>"Update Event type", "conference_id"=>"example", "id"=>"1"}
Completed 500 Internal Server Error

NoMethodError (undefined method `%' for nil:NilClass

    errors.add(:length, "must be a divisor of #{program.schedule_interval}") if program && length % program.schedule_interval != 0
                                                                                                  ^):

app/models/event_type.rb:27:in `length_step'
app/controllers/admin/event_types_controller.rb:29:in `update'

Expected correct behavior

Either a validation error (not a server error) is returned or a default value is used.

Steps to reproduce

  1. Create a conference.
  2. At ManageEvent TypesEdit, blank the Length field and click Update Event type.

Other information

I briefly researched whether the length_step validation could be made dependent on the numericality validation, but didn’t find a straightforward solution.

@hennevogel hennevogel added the bug 🐛 Something is wrong and needs to be fixed label Apr 19, 2023
@makrianast
Copy link

i would like to work on that

@hennevogel
Copy link
Member

@makrianast what's stopping you to submit a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something is wrong and needs to be fixed
Projects
None yet
Development

No branches or pull requests

3 participants