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

Custom sort for processes : server error when processes have empty / missing date #619

Open
moustachu opened this issue Oct 30, 2024 · 0 comments
Labels
release: v2.5 Candidate for 2.5 release release: v2.5.0

Comments

@moustachu
Copy link
Member

Describe the bug
When the custom sort for processes is enabled (env var SORT_PROCESSES_BY_DATE=true), the front processes index return an HTTP error 500.
This need to be investigate but the probable cause is that existing processes have empty or missing start/end date.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Custom sort for processes with env var SORT_PROCESSES_BY_DATE=true
  2. Check if there at least one process with an empty end date
  3. Got to /processes
  4. See error

Expected behavior
No error and the custom sort for processes enabled

Stacktrace
Application log

2024-10-30 14:46:42.480	F, [2024-10-30T13:46:42.480009 #1] FATAL -- : [fb777f2796a29e87a2c41a9e4d926f3f]   
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] ActionView::Template::Error (comparison of Date with nil failed):
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     25:     <%= render partial: "decidim/shared/participatory_space_filters/show" %>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     26:     <p class="loading"><%= t(".loading") %></p>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     27:     <div class="row small-up-1 medium-up-2 large-up-3 card-grid">
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     28:       <%= render(collection) %>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     29:     </div>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     30:   </section>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]     31: <% end %>
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f]   
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] app/controllers/decidim/participatory_processes/participatory_processes_controller.rb:139:in `sort_by'
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] app/controllers/decidim/participatory_processes/participatory_processes_controller.rb:139:in `custom_sort'
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] app/controllers/decidim/participatory_processes/participatory_processes_controller.rb:96:in `participatory_processes'
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] app/controllers/decidim/participatory_processes/participatory_processes_controller.rb:85:in `collection'
2024-10-30 14:46:42.480	[fb777f2796a29e87a2c41a9e4d926f3f] app/controllers/decidim/participatory_processes/participatory_processes_controller.rb:13:in `collection'

Additional context
see Pull request #596

@moustachu moustachu added release: v2.5 Candidate for 2.5 release release: v2.5.0 labels Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: v2.5 Candidate for 2.5 release release: v2.5.0
Projects
None yet
Development

No branches or pull requests

1 participant