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

another bug, when I log time entries in projects without any contracts, it would be 500 error #58

Open
archonwang opened this issue Mar 21, 2017 · 8 comments

Comments

@archonwang
Copy link
Contributor

archonwang commented Mar 21, 2017

Hi, @wesoccer2003 , @upgradeya, @FireMartZ, please help to check it. Thanks.
another bug, when I log time entries in projects without any contracts, it would be 500 error.

Started POST "/time_entries" for 192.168.60.238 at 2017-03-21 10:22:42 +0800
Processing by TimelogController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"p5b8AU5rpPCVYBS8r0cUzD1ZYyRtHClxRlnpLXswSik5VONAy42dGi6TYwB0DoM6RkKVsdxM6OK2oHokpF/Ykg==", "back_url"=>"http://192.168.1.41/issues/15", "issue_id"=>"15", "time_entry"=>{"issue_id"=>"15", "spent_on"=>"2017-03-21", "hours"=>"1", "comments"=>"test", "activity_id"=>"17"}, "commit"=>"create"}
  Current user: hui.wang (id=8)
Completed 500 Internal Server Error in 25ms (ActiveRecord: 6.1ms)

error log 
NoMethodError (undefined method `is_fixed_price' for nil:NilClass):
  plugins/contracts/lib/contracts/patches/time_entry_patch.rb:29:in `time_not_exceed_contract'
  app/controllers/timelog_controller.rb:113:in `create'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'
@archonwang
Copy link
Contributor Author

archonwang commented Mar 27, 2017

debug log

A NoMethodError occurred in issues#update:
 
  undefined method `is_fixed_price' for nil:NilClass
  plugins/contracts/lib/contracts/patches/time_entry_patch.rb:29:in `time_not_exceed_contract'
 
 
-------------------------------
Request:
-------------------------------
 
* URL : http://192.168.1.41/issues/8786
  * HTTP Method: PATCH
  * IP address : 192.168.50.252
  * Parameters : {"utf8"=>"✓", "_method"=>"patch", "authenticity_token"=>"2yNGnqD4Rc7jFBS+s/JRTwOdivOXEO4ePbvrutE4QW0TaTBOeDNdKKMz601hpOXzz93B2sP/FahebpQ1RChZ9Q==", "form_update_triggered_by"=>"", "issue"=>{"project_id"=>"39", "tracker_id"=>"5", "subject"=>"1ST测试", "description"=>"<blockquote>\r\n<p>针对 sesameTM.1.02.20170324的相关测试。</p>\r\n\r\n<p>version#943</p>\r\n</blockquote>\r\n", "status_id"=>"9", "priority_id"=>"2", "assigned_to_id"=>"103", "fixed_version_id"=>"", "start_date"=>"2017-03-17", "due_date"=>"2017-03-24", "estimated_hours"=>"8.0", "notes"=>"", "private_notes"=>"0", "lock_version"=>"6"}, "new_checklist"=>"", "time_entry"=>{"hours"=>"8", "activity_id"=>"9", "comments"=>""}, "last_journal_id"=>"26513", "commit"=>"提交", "prev_issue_id"=>"8808", "next_issue_id"=>"8783", "issue_position"=>"3", "issue_count"=>"14", "controller"=>"issues", "action"=>"update", "id"=>"8786"}
  * Timestamp  : 2017-03-27 01:19:16 UTC
  * Server : jira
  * Rails root : /opt/redmine-3.3
  * Process: 19470
 
-------------------------------
Session:
-------------------------------
 
  * session id: "54d6dcf4250bc6ecd8240348b0cad200"
  * data: {"session_id"=>"54d6dcf4250bc6ecd8240348b0cad200",
   "user_id"=>103,
   "tk"=>"1b6571b9ea04a628899ec61b62f908cbd1005bf9",
   "sudo_timestamp"=>1490577492,
   "_csrf_token"=>"yEp20NjLGOZAJ//z0la0vMxASylU7/u2Y9V/j5UQGJg=",
   "query"=>
    {:project_id=>39,
     :filters=>{"status_id"=>{:operator=>"o", :values=>[""]}},
     :group_by=>"parent",
     :column_names=>nil,
     :totalable_names=>[:estimated_hours, :spent_hours]},
   "issues_index_sort"=>"id:desc"}
 
-------------------------------
Environment:
-------------------------------
 
  * CONTENT_LENGTH                                 : 3578
  * CONTENT_TYPE                                   : multipart/form-data; boundary=---------------------------8491437216664
  * GATEWAY_INTERFACE                              : CGI/1.2
  * HTTP_ACCEPT                                    : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  * HTTP_ACCEPT_ENCODING                           : gzip, deflate
  * HTTP_ACCEPT_LANGUAGE                           : zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
  * HTTP_CONNECTION                                : keep-alive
  * HTTP_COOKIE                                    : _redmine_session=MG9qWDVUSURuOWsvcks1MzFVa2w4TlMwVEtMQ2pRL2R1NGNLeEpXY1A2Y3A2aTBqQmROaXAvMTFPU2Jab20zMmkwV0lUMTZhampnNGxyaWRhRkxrbS9ZVVJHaTJuZzlveHJIVXBxVVB4V004U2FoOFdwZlQ4TWpEYUs4dnZ4Z0pFR28vdlQ1ZldERzlEeVJJQjFPNWdZSVFJTjhxUUJHY1gvOTBLSytmRG4wdFFNbng4Z25oTzdjTUVUOXlTVy9QaGxyR0tPL0tSSUVSclk2VEdGaC9EaFZmOU5ia0k5Z2hjWlJ0RDNhZW9QS05rYU5zbDFNNGFmVjJ6SitIUlRqSXRzalpWV1hIM0FkSG54cFRDYTlxVHdrTjFtZXpkcTdXZHZJZW9lcVE5V0YzNlJ5WFF6NnhaT3FTWHMzSG5TUFcxZkJ1cFFvYTJtdmRoaGlBWDc2Ni9IQTdvRnJjQkxFWnVUN204T3JubGZaV3RydFFnbitaMnpSa1FsQ2tCWHYwZ3BXSkM2T2ducnpWQTcyalpxZjc1V0hwRVY5MFhCQUJvclU2ak9QcXZGbHUxaW4xZmxzei82M3I1OUtQWThqSy9pUmY2OXhlZEZobkROSWJFRWhvNzdWLysrT0h1a0lLMW1LdENoQ25nc0xlOHFYSEtIR2FwNGpNTkFUR08xcThCbHNnRU8zU0wyMlU4YjEzR2pwaVY4Vk5xamtpbXlZcjBISVZDMWZjdHNtVzdlOGNTUWNIUUZYVVMvMmkwSDZ6RGtDekdZQzhWLysvaFNiV0lkWGp0dz09LS1SVE8wRWdSTUhhUnBZYW9TU0NTRy9nPT0%3D--93466cb28ee976d47cb3f17314d0869cc0417813
  * HTTP_HOST                                      : 192.168.1.41
* HTTP_REFERER : http://192.168.1.41/issues/8786
  * HTTP_UPGRADE_INSECURE_REQUESTS                 : 1
  * HTTP_USER_AGENT                                : Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
  * HTTP_VERSION                                   : HTTP/1.1
  * ORIGINAL_FULLPATH                              : /issues/8786
  * ORIGINAL_SCRIPT_NAME                           :
  * PATH_INFO                                      : /issues/8786
  * QUERY_STRING                                   :
  * REMOTE_ADDR                                    : 192.168.50.252
  * REQUEST_METHOD                                 : PATCH
  * REQUEST_PATH                                   : /issues/8786
  * REQUEST_URI                                    : /issues/8786
  * ROUTES_35056740_SCRIPT_NAME                    :
  * SCRIPT_NAME                                    :
  * SERVER_NAME                                    : 192.168.1.41
  * SERVER_PORT                                    : 80
  * SERVER_PROTOCOL                                : HTTP/1.1
  * SERVER_SOFTWARE                                : thin 1.7.0 codename Dunder Mifflin
  * action_controller.instance                     : #<IssuesController:0x007fa0ca1195c8>
  * action_dispatch.backtrace_cleaner              : #<Rails::BacktraceCleaner:0x00000002f35f28>
  * action_dispatch.cookies                        : #<ActionDispatch::Cookies::CookieJar:0x007fa0ca0add00>
  * action_dispatch.cookies_digest                 :
  * action_dispatch.cookies_serializer             :
  * action_dispatch.encrypted_cookie_salt          : encrypted cookie
  * action_dispatch.encrypted_signed_cookie_salt   : signed encrypted cookie
  * action_dispatch.http_auth_salt                 : http authentication
  * action_dispatch.key_generator                  : #<ActiveSupport::CachingKeyGenerator:0x000000041d2a50>
  * action_dispatch.logger                         : #<ActiveSupport::Logger:0x00000004247ad0>
  * action_dispatch.parameter_filter               : [:password]
  * action_dispatch.redirect_filter                : []
  * action_dispatch.remote_ip                      : 192.168.50.252
  * action_dispatch.request.content_type           : multipart/form-data
  * action_dispatch.request.formats                : [#<Mime::Type:0x00000003fc2350 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html", @hash=906766942597563472>]
  * action_dispatch.request.parameters             : {"utf8"=>"✓", "_method"=>"patch", "authenticity_token"=>"2yNGnqD4Rc7jFBS+s/JRTwOdivOXEO4ePbvrutE4QW0TaTBOeDNdKKMz601hpOXzz93B2sP/FahebpQ1RChZ9Q==", "form_update_triggered_by"=>"", "issue"=>{"project_id"=>"39", "tracker_id"=>"5", "subject"=>"1ST测试", "description"=>"<blockquote>\r\n<p>针对 sesameTM.1.02.20170324的相关测试。</p>\r\n\r\n<p>version#943</p>\r\n</blockquote>\r\n", "status_id"=>"9", "priority_id"=>"2", "assigned_to_id"=>"103", "fixed_version_id"=>"", "start_date"=>"2017-03-17", "due_date"=>"2017-03-24", "estimated_hours"=>"8.0", "notes"=>"", "private_notes"=>"0", "lock_version"=>"6"}, "new_checklist"=>"", "time_entry"=>{"hours"=>"8", "activity_id"=>"9", "comments"=>""}, "last_journal_id"=>"26513", "commit"=>"提交", "prev_issue_id"=>"8808", "next_issue_id"=>"8783", "issue_position"=>"3", "issue_count"=>"14", "controller"=>"issues", "action"=>"update", "id"=>"8786"}
  * action_dispatch.request.path_parameters        : {:controller=>"issues", :action=>"update", :id=>"8786"}
  * action_dispatch.request.query_parameters       : {}
  * action_dispatch.request.request_parameters     : {"utf8"=>"✓", "_method"=>"patch", "authenticity_token"=>"2yNGnqD4Rc7jFBS+s/JRTwOdivOXEO4ePbvrutE4QW0TaTBOeDNdKKMz601hpOXzz93B2sP/FahebpQ1RChZ9Q==", "form_update_triggered_by"=>"", "issue"=>{"project_id"=>"39", "tracker_id"=>"5", "subject"=>"1ST测试", "description"=>"<blockquote>\r\n<p>针对 sesameTM.1.02.20170324的相关测试。</p>\r\n\r\n<p>version#943</p>\r\n</blockquote>\r\n", "status_id"=>"9", "priority_id"=>"2", "assigned_to_id"=>"103", "fixed_version_id"=>"", "start_date"=>"2017-03-17", "due_date"=>"2017-03-24", "estimated_hours"=>"8.0", "notes"=>"", "private_notes"=>"0", "lock_version"=>"6"}, "new_checklist"=>"", "time_entry"=>{"hours"=>"8", "activity_id"=>"9", "comments"=>""}, "last_journal_id"=>"26513", "commit"=>"提交", "prev_issue_id"=>"8808", "next_issue_id"=>"8783", "issue_position"=>"3", "issue_count"=>"14"}
  * action_dispatch.request.unsigned_session_cookie: {"session_id"=>"54d6dcf4250bc6ecd8240348b0cad200", "user_id"=>103, "tk"=>"1b6571b9ea04a628899ec61b62f908cbd1005bf9", "sudo_timestamp"=>1490577492, "_csrf_token"=>"yEp20NjLGOZAJ//z0la0vMxASylU7/u2Y9V/j5UQGJg=", "query"=>{:project_id=>39, :filters=>{"status_id"=>{:operator=>"o", :values=>[""]}}, :group_by=>"parent", :column_names=>nil, :totalable_names=>[:estimated_hours, :spent_hours]}, "issues_index_sort"=>"id:desc"}
  * action_dispatch.request_id                     : c09397ad-605a-4a30-a600-4f87c11370ed
  * action_dispatch.routes                         : #<ActionDispatch::Routing::RouteSet:0x000000042dd8c8>
  * action_dispatch.secret_key_base                : 59dda17a42803617f96151518b9aeecb94e132c6f140123f1982e1c8ae15d0103ffa854c4d8b0019
  * action_dispatch.secret_token                   :
  * action_dispatch.show_detailed_exceptions       : false
  * action_dispatch.show_exceptions                : true
  * action_dispatch.signed_cookie_salt             : signed cookie
  * async.callback                                 : #<Method: Thin::Connection#post_process>
  * async.close                                    : #<EventMachine::DefaultDeferrable:0x007fa0ca19a8d0>
  * rack.errors                                    : #<IO:0x000000014f9588>
  * rack.input                                     : #<StringIO:0x007fa0ca19b4d8>
  * rack.methodoverride.original_method            : POST
  * rack.multiprocess                              : false
  * rack.multithread                               : true
  * rack.request.cookie_hash                       : {"_redmine_session"=>"MG9qWDVUSURuOWsvcks1MzFVa2w4TlMwVEtMQ2pRL2R1NGNLeEpXY1A2Y3A2aTBqQmROaXAvMTFPU2Jab20zMmkwV0lUMTZhampnNGxyaWRhRkxrbS9ZVVJHaTJuZzlveHJIVXBxVVB4V004U2FoOFdwZlQ4TWpEYUs4dnZ4Z0pFR28vdlQ1ZldERzlEeVJJQjFPNWdZSVFJTjhxUUJHY1gvOTBLSytmRG4wdFFNbng4Z25oTzdjTUVUOXlTVy9QaGxyR0tPL0tSSUVSclk2VEdGaC9E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aGlBWDc2Ni9IQTdvRnJjQkxFWnVUN204T3JubGZaV3RydFFnbitaMnpSa1FsQ2tCWHYwZ3BXSkM2T2ducnpWQTcyalpxZjc1V0hwRVY5MFhCQUJvclU2ak9QcXZGbHUxaW4xZmxzei82M3I1OUtQWThqSy9pUmY2OXhlZEZobkROSWJFRWhvNzdWLysrT0h1a0lLMW1LdENoQ25nc0xlOHFYSEtIR2FwNGpNTkFUR08xcThCbHNnRU8zU0wyMlU4YjEzR2pwaVY4Vk5xamtpbXlZcjBISVZDMWZjdHNtVzdlOGNTUWNIUUZYVVMvMmkwSDZ6RGtDekdZQzhWLysvaFNiV0lkWGp0dz09LS1SVE8wRWdSTUhhUnBZYW9TU0NTRy9nPT0%3D--93466cb28ee976d47cb3f17314d0869cc0417813
  * rack.request.form_hash                         : {"utf8"=>"✓", "_method"=>"patch", "authenticity_token"=>"2yNGnqD4Rc7jFBS+s/JRTwOdivOXEO4ePbvrutE4QW0TaTBOeDNdKKMz601hpOXzz93B2sP/FahebpQ1RChZ9Q==", "form_update_triggered_by"=>"", "issue"=>{"project_id"=>"39", "tracker_id"=>"5", "subject"=>"1ST测试", "description"=>"<blockquote>\r\n<p>针对 sesameTM.1.02.20170324的相关测试。</p>\r\n\r\n<p>version#943</p>\r\n</blockquote>\r\n", "status_id"=>"9", "priority_id"=>"2", "assigned_to_id"=>"103", "fixed_version_id"=>"", "start_date"=>"2017-03-17", "due_date"=>"2017-03-24", "estimated_hours"=>"8.0", "notes"=>"", "private_notes"=>"0", "lock_version"=>"6"}, "new_checklist"=>"", "time_entry"=>{"hours"=>"8", "activity_id"=>"9", "comments"=>""}, "last_journal_id"=>"26513", "commit"=>"提交", "prev_issue_id"=>"8808", "next_issue_id"=>"8783", "issue_position"=>"3", "issue_count"=>"14"}
  * rack.request.form_input                        : #<StringIO:0x007fa0ca19b4d8>
  * rack.request.query_hash                        : {}
  * rack.request.query_string                      :
  * rack.run_once                                  : false
  * rack.session                                   : #<ActionDispatch::Request::Session:0x007fa0ca145510>
  * rack.session.options                           : #<ActionDispatch::Request::Session::Options:0x007fa0ca1454c0>
  * rack.tempfiles                                 : [#<Tempfile:/tmp/RackMultipart20170327-19470-8ogxwt>, #<Tempfile:/tmp/RackMultipart20170327-19470-e7lx2>]
  * rack.url_scheme                                : http
  * rack.version                                   : [1, 0]
 
-------------------------------
Backtrace:
-------------------------------
 
  plugins/contracts/lib/contracts/patches/time_entry_patch.rb:29:in `time_not_exceed_contract'
  app/controllers/issues_controller.rb:523:in `block in save_issue_with_child_records'
  app/controllers/issues_controller.rb:515:in `save_issue_with_child_records'
  app/controllers/issues_controller.rb:184:in `update'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

@archonwang
Copy link
Contributor Author

archonwang commented Mar 27, 2017

@wesoccer2003 , @FireMartZ ,
I made it with these steps

  1. open an issue detail page
  2. edit the issue and input time entry
    3 submit the modification and occur 500 error
    please check it.

@dmp1ce
Copy link
Member

dmp1ce commented Apr 19, 2017

I'm also seeing this issue.

@dmp1ce
Copy link
Member

dmp1ce commented Apr 19, 2017

I believe the issue is occurring on this line if anyone need to apply a fix for themselves. https://github.com/upgradeya/redmine-contracts-with-time-tracking-plugin/blob/master/lib/contracts/patches/time_entry_patch.rb#L29

@FireMartZ
Copy link

Yes, change the line like that:
FireMartZ@66bd08d

@dmp1ce
Copy link
Member

dmp1ce commented Apr 19, 2017

Would you mind making a pull request if you have tested the change @FireMartZ ?

@archonwang
Copy link
Contributor Author

@dmp1ce , I have tested the fork form @FireMartZ -branch master
and it works well.

WoW~~ Great Job!

Thanks @FireMartZ .

@dmp1ce
Copy link
Member

dmp1ce commented Apr 21, 2017

Thank you @archonwang and @FireMartZ. I'll try to get @wesoccer2003 back soon to make merge.

@dmp1ce dmp1ce reopened this Apr 21, 2017
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

3 participants