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 while opening proposal component on admin page #89

Open
fblupi opened this issue Sep 11, 2024 · 0 comments
Open

Error while opening proposal component on admin page #89

fblupi opened this issue Sep 11, 2024 · 0 comments

Comments

@fblupi
Copy link

fblupi commented Sep 11, 2024

I installed the module with the default configuration and found an error while accessing the proposal component page on the admin page. The error backtrace is the one below:

ActionView::Template::Error (nil can't be converted to a Time value):
       <% elsif proposal.accepted? || proposal.rejected? %>
       <div class="help-text-overdue text-success">
         <%= t("decidim.reporting_proposals.admin.resolution_time") %>:
         <%= time_elapsed_to_answer(proposal) %>
       </div>
     <% end %>
   </div>

I analyzed it and found out the component has a rejected proposal, but that proposal doesn't have a value for the answered_at column used in the time_elapsed_to_answer method. So it's causing this error as you call the distance_of_time_in_words with a nil value.

Maybe we should change from:

<% elsif proposal.accepted? || proposal.rejected? %>

to:

<% elsif (proposal.accepted? || proposal.rejected?) && proposal.answered_at.present? %>

Or use another attribute, as answered_at could be nil on rejected proposals.

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

No branches or pull requests

1 participant