samchen2009 / ekanban

a kanban plugin for redmine
102 stars 42 forks source link

Cannot create new issues after setting up kanban #16

Closed sheldonshi closed 11 years ago

sheldonshi commented 11 years ago

This is Redmine 2.2.3, with the up-to-date ekanban code. I followed the instruction and set up kanban for each of the bug, feature, support trackers. I could see these kanbans correctly under the project's Kanban tab. But when I tried to create bugs, I got an error.

Started POST "/redmine/projects/test-performance/issues" for 50.150.73.169 at 2013-03-21 00:26:42 +0000 Processing by IssuesController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"KEH8YezZcuVFLTvAwRSouW9uenrxvE1AWQ95NfRrzow=", "issue"=>{"is_private"=>"0", "tracker_id"=>"1", "subject"=>"new buggs", "description"=>"", "status_id"=>"1", "priority_id"=>"2", "assigned_to_id"=>"", "parent_issue_id"=>"", "start_date"=>"2013-03-21", "due_date"=>""}, "attachments"=>{"1"=>{"description"=>""}}, "commit"=>"Create", "project_id"=>"test-performance"} Current user: user (id=1) Completed 500 Internal Server Error in 214ms

NoMethodError (undefined method issue_status' for #<Issue:0x007fe649693f20>): app/controllers/issues_controller.rb:142:increate'

It looks like issue status wasn't set, but on the UI it was clearly set in the drop down. Before setting up Kanban, creating new issues was working fine.

samchen2009 commented 11 years ago

Very likely, it's caused by code below in kanban.rb, could you add some 'puts' there to help to identify the cause?

     def validate_kanban_card_new
        issue = self
        kanban = Kanban.find_by_project_id_and_tracker_id(issue.project_id,issue.tracker_id)
       return true if kanban.nil?
       state_id = IssueStatusKanbanState.state_id(issue.status_id, issue.tracker_id)

       if (state_id.nil?)
         errors.add(:status_id, ":No kanban state associated with status '#{issue.issue_status.name}', contact redmine admin!")
         return false
       end

       pane = KanbanPane.pane_by(state_id, kanban);

       if pane.nil?
          errors.add(:status_id, ":No kanban pane associated with status '#{issue.issue_status.name}', contact redmine admin!")
          return false
     end
sheldonshi commented 11 years ago

I changed kanban state settings and issue status<-> kanban states mapping, I get a different error when creating new issues. Started PUT "/redmine/issues/9" for 50.150.73.169 at 2013-03-21 16:00:33 +0000 Processing by IssuesController#update as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"KEH8YezZcuVFLTvAwRSouW9uenrxvE1AWQ95NfRrzow=", "issue"=>{"is_private"=>"0", "tracker_id"=>"2", "subject"=>"a new feature", "description"=>"", "status_id"=>"1", "priority_id"=>"2", "assigned_to_id"=>"4", "parent_issue_id"=>"", "start_date"=>"2013-03-21", "due_date"=>"", "estimated_hours"=>"", "done_ratio"=>"0", "notes"=>"", "private_notes"=>"0", "lock_version"=>"0"}, "time_entry"=>{"hours"=>"", "activity_id"=>"", "comments"=>""}, "attachments"=>{"1"=>{"description"=>""}}, "last_journal_id"=>"", "commit"=>"Submit", "id"=>"9"} Current user: user (id=1) Rendered mailer/_issue.text.erb (6.6ms) Rendered mailer/issue_edit.text.erb within layouts/mailer (13.7ms) Rendered mailer/_issue.html.erb (2.5ms) Rendered mailer/issue_edit.html.erb within layouts/mailer (8.1ms) Completed 500 Internal Server Error in 2225ms

NoMethodError (undefined method name' for nil:NilClass): lib/redmine/hook.rb:61:inblock (2 levels) in call_hook' lib/redmine/hook.rb:61:in each' lib/redmine/hook.rb:61:inblock in call_hook' lib/redmine/hook.rb:58:in tap' lib/redmine/hook.rb:58:incall_hook' app/models/issue.rb:967:in block in save_issue_with_child_records' app/models/issue.rb:952:insave_issue_with_child_records' app/controllers/issues_controller.rb:176:in `update'

So I suspect this is sensitive to how Kanban states and relations to issue status are setup. I attached my setup because I cannot view the setup in demo. Could you take a look to see if there is anything incorrect? Thanks. Screen Shot 2013-03-21 at 2 33 50 PM Screen Shot 2013-03-21 at 2 34 07 PM Screen Shot 2013-03-21 at 2 34 18 PM

samchen2009 commented 11 years ago

From the log "IssuesController#update", you tried to update an existing issue, I guess it's created before kanban setup. I tried this case and reproduce similar error. So I update a new cl https://github.com/samchen2009/ekanban/commit/591d839c4f08f2cc790e7d20d3a10cd2a078a0f3 to solve it. Please have a try.

And I also encountered another wield "NoMethodFound" issue, which is indeed implemented in code. It only happen on development mode. There're something not good enough in kanban.rb and I'm going to fix it, before that happen, please try production mode as could as possible.

samchen2009 commented 11 years ago

Push a new change 1d4deeb5d042db4ec99692f21b15c334abb23a2d, which extend the redmine model in a proper way, now various "NoMethodError" in development mode should be much less than before.

mlucero14 commented 10 years ago

Hi: I set up the kanban states with the issue status = BUG but when I create issues of type BUG they don't appear into the backog pane in spite of being created. Can you help me with that, please?

setup kanban states

samchen2009 commented 10 years ago

Could you dump some relative rows in database (kanban_state, kanban_pane, kanban, kanban_cards ) and paste here? I guess you don't have a pane associated to 'Backlog' state.