alexmonteiro / Redmine-Monitoring-Controlling

Redmine Plugin that works with Highcharts to show tasks on project throught Charts.
Other
131 stars 79 forks source link

Couldn't find User with id #40

Closed logical-and closed 11 years ago

logical-and commented 12 years ago

I got this error on human resources page:

ActiveRecord::RecordNotFound (Couldn't find User with id=11 [WHERE `users`.`type` IN ('User', 'AnonymousUser')]):
  activerecord (3.2.5) lib/active_record/relation/finder_methods.rb:339:in `find_one'
  activerecord (3.2.5) lib/active_record/relation/finder_methods.rb:310:in `find_with_ids'
  activerecord (3.2.5) lib/active_record/relation/finder_methods.rb:107:in `find'
  activerecord (3.2.5) lib/active_record/querying.rb:5:in `find'
  plugins/redmine_monitoring_controlling/app/views/mc_human_resource_mgmt_project/_scripts.html.erb:25:in `block in _plugins_redmine_monitoring_controlling_app_views_mc_human_resource_mgmt_project__scripts_html_erb___1695065111934309898_70268800'
  plugins/redmine_monitoring_controlling/app/views/mc_human_resource_mgmt_project/_scripts.html.erb:24:in `each'
  plugins/redmine_monitoring_controlling/app/views/mc_human_resource_mgmt_project/_scripts.html.erb:24:in `_plugins_redmine_monitoring_controlling_app_views_mc_human_resource_mgmt_project__scripts_html_erb___1695065111934309898_70268800'

11 - it is not user, but group. Seems like plugin doesn`t work with groups, properly. Alex, need a fix. =)

logical-and commented 12 years ago

To fix it:

@statusesByAssigneds = Issue.find_by_sql("select assigned_to_id, (select firstname from users where id = assigned_to_id) as assigned_name,
                                              issue_statuses.id, issue_statuses.name, 
                                                (select COUNT(1) 
                                               from issues i 
                                               where i.project_id in (#{stringSqlProjectsSubProjects})
                                               and ((i.assigned_to_id = issues.assigned_to_id and i.assigned_to_id is not null)or(i.assigned_to_id is null and issues.assigned_to_id is null)) and i.status_id = issue_statuses.id) as totalassignedbystatuses
                                               from issues, issue_statuses, users
                                               where project_id in (#{stringSqlProjectsSubProjects})
                                                and users.id = assigned_to_id
                                                and users.type = 'User'
                                               group by assigned_to_id, assigned_name, issue_statuses.id, issue_statuses.name
                                               order by 2,3;")    

But still need a groups. =)

ghost commented 12 years ago

Hi,

I got the same error with above. Is there any way to fix the problem between Redmine-Monitoring-Controlling and Group? I really appreciate your support!

Regards,