Defect #24746

Template::Error after project and issue rebuild

Added by del med about 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
Resolution:Invalid Affected version:3.2.0

Description

Hello,
i had a issue with projects tree. i found a 'solution' in this forum to rebuild the tree:

ruby bin/rails runner 'Project.rebuild_tree!' RAILS_ENV=production
ruby bin/rails runner 'Issue.rebuild_tree!' RAILS_ENV=production

now projects tree a re fine, but when i would like to enter in the project-issue page, i have an error:

Started GET "/projects/xxx/issues" for xx.xx.xx.xx at 2017-01-03 18:11:11 +0100
Processing by IssuesController#index as HTML
  Parameters: {"project_id"=>"xxx"}
  Current user: xx(id=xx)
  Rendered queries/_filters.html.erb (24.9ms)
  Rendered issues/index.html.erb within layouts/base (26.5ms)
Completed 500 Internal Server Error in 128ms (ActiveRecord: 44.7ms)

ActionView::Template::Error (comparison of NilClass with 218 failed):
    3: var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
    4: var availableFilters = <%= raw_json query.available_filters_as_json %>;
    5: var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
    6: var allProjects = <%= raw_json query.all_projects_values %>;
    7: $(document).ready(function(){
    8:   initFilters();
    9:   <% query.filters.each do |field, options| %>
  app/models/project.rb:784:in `sort_by'
  app/models/project.rb:784:in `project_tree'
  app/models/query.rb:336:in `all_projects_values'
  app/views/queries/_filters.html.erb:6:in `block in _app_views_queries__filters_html_erb__928470405_121460600'
  app/views/queries/_filters.html.erb:1:in `_app_views_queries__filters_html_erb__928470405_121460600'
  app/views/issues/index.html.erb:19:in `block in _app_views_issues_index_html_erb__380465873_120187980'
  app/views/issues/index.html.erb:11:in `_app_views_issues_index_html_erb__380465873_120187980'
  app/controllers/issues_controller.rb:77:in `block (2 levels) in index'
  app/controllers/issues_controller.rb:76:in `index'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

i note the the number 218 is always the same even if i change project.
can someone help me please.

Environment:
  Redmine version                3.2.0.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [i486-linux]
  Rails version                  4.2.5
  Environment                    production
  Database adapter               Mysql2

thanks.

History

#1 Updated by Toshi MARUYAMA about 6 years ago

  • Status changed from New to Needs feedback
  • Priority changed from Urgent to Normal

Why do you use such old Ruby?
Please update Redmine from 3.2.0 to latest 3.2.4.
Then re-run "Project.rebuild_tree!".
It seems your Project.lft is null. It is wrong.

#2 Updated by del med about 6 years ago

Thanks Toshi for this reply.
i'm upgrading my ruby version to 2.2.6 the i will upgrade redmine for 3.2.4.
but for now, i didn't find any Project or issue with lft, rgt or root_id null !

#3 Updated by Toshi MARUYAMA about 6 years ago

Do you use plugins?

#4 Updated by del med about 6 years ago

the probleme come from project table.
i set lft and rgt to 0, then i create a new sub-project of project id = 1.
normally redmine should recalculate and update all lft and rgt value, but it's not the case. il have always values equal to 0 and the new project 1/2 .
i tried to update all projects to 1/2 and create a new sub-project of project id =1.
i have lft and rgt equal:
  • first SP: 3/4
  • second SP: 4/5
  • Parent: 1/2
  • next project : 1/2
normally i should have :
  • first SP: 2/3
  • second SP: 4/5
  • Parent: 1/6
  • next project : 7/8

there's a way to recalculate this please ? even by sql query !

#5 Updated by del med about 6 years ago

For plug-ins I have creditors and http://redminecrm.com/ with light version.

#6 Updated by del med about 6 years ago

up please.

#7 Updated by Toshi MARUYAMA about 6 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Invalid

del med wrote:

i set lft and rgt to 0,

You are wrong.
https://en.wikipedia.org/wiki/Nested_set_model

Also available in: Atom PDF