#1244

cannot check a todo as complete

    • Created on: Sat, Feb 11 (3 months ago)
    • Reported by: popsch
    • Assigned to: -
    • Milestone: 2.1
    • Type: defect
    • Resolution: -
    • Version: 1.7
    • Status: Invalid
    • Priority: Normal (3)
    • Component: Functionality (app)
    • Estimate: None/Small/Medium/Large None
    • Severity: normal
    • Keywords: -
    I got some weird inconsistency in the database. I cannot mark a todo as completed.

    This is the xml of the todo:
    <todo>
      <completed-at type="datetime" nil="true"/>
      <context-id type="integer">9</context-id>
      <created-at type="datetime">2012-01-30T22:41:41-05:00</created-at>
      <description>
        removed
      </description>
      <due type="datetime">2012-01-30T00:00:00-05:00</due>
      <id type="integer">496</id>
      <notes/>
      <project-id type="integer">106</project-id>
      <recurring-todo-id type="integer" nil="true"/>
      <show-from type="datetime">2012-01-30T05:00:00Z</show-from>
      <state>active</state>
      <updated-at type="datetime">2012-01-30T22:41:41-05:00</updated-at>
      <tags type="array">
        <tag>
          <created-at type="datetime">2011-09-15T13:08:13-04:00</created-at>
          <id type="integer">5</id>
          <name>low</name>
          <updated-at type="datetime">2011-09-15T13:08:13-04:00</updated-at>
        </tag>
        <tag>
          <created-at type="datetime">2011-09-02T19:40:57-04:00</created-at>
          <id type="integer">3</id>
          <name>starred</name>
          <updated-at type="datetime">2011-09-02T19:40:57-04:00</updated-at>
        </tag>
      </tags>
    </todo>
  • Followers
     
    Ico-users lrbalt , popsch , voxspox 
     
    Attachments
    Fico_png
    15.2 KB Added by popsch on 11 Feb 21:52 UTC   Details
    Fico_png
    28 KB Added by popsch on 11 Feb 21:52 UTC   Details
    Associations
     
    No associations
    Activity
     
    User picture

          on Feb 11, 2012 @ 09:52pm UTC * By popsch

    Attachment bug-console-output.png added
    cZj8hQvpOr4yKPacwqjQXA
    User picture

          on Feb 11, 2012 @ 09:52pm UTC * By popsch

    Attachment bug-tracks-interface.png added
    cZj9IMvpOr4yKPacwqjQXA
    User picture

          on Feb 19, 2012 @ 03:22am UTC * By popsch

    Digging a little more, it seems that "todos.show_from" wasn't cleared. Thus both

        @not_done = @project.todos.active_or_hidden(:include => Todo::DEFAULT_INCLUDES)
        @deferred = @project.todos.deferred(:include => Todo::DEFAULT_INCLUDES)


    return the same todo.

    Tracks would need something at the startup to check all todos, whether any show_from lies in the past and set it to NULL.
    User picture

          on Feb 19, 2012 @ 03:26am UTC * By popsch

    The problem lies in todo.rb:
      named_scope :deferred, :conditions => ["todos.completed_at IS NULL AND NOT (todos.show_from IS NULL)"]

    This doesn't check whether the show_from is in the past and thus the todo should be active now.
    User picture

          on Feb 22, 2012 @ 08:43am UTC * By lrbalt

    todos are activated from deferred state every time you access the home page or the tickler page, see https://github.com/TracksApp/tracks/blob/master/app/controllers/todos_controller.rb#L7 and https://github.com/TracksApp/tracks/blob/master/app/controllers/todos_controller.rb#L864. When the state changes from deferred to active, the show_from should be cleared, see https://github.com/TracksApp/tracks/blob/master/app/models/todo.rb#L60

    There is something very wrong in that it shows the same todo twice on the page. I have never seen this. Code-wise this should not be possible.In this case it is caused by show_from not being empty.

    The most interesting part is, how did this todo get in this state? Why didn't the exit proc fire on changing state?
    User picture

          on Feb 22, 2012 @ 08:45am UTC * By lrbalt

    oh, to get your database consistent, just clear the show_from of this todo
    User picture

          on Feb 22, 2012 @ 01:49pm UTC * By lrbalt

    Status changed from New to Invalid
    closing this for now, but please reopen if you can reproduce getting into this incorrect state...
    User picture

          on Mar 05, 2012 @ 02:08am UTC * By popsch

    Status changed from Invalid to New
    User picture

          on Mar 05, 2012 @ 06:58pm UTC * By lrbalt

    Type set to defect
    Severity changed from major to normal
    Version set to 1.7
    Component changed from None to Functionality (app)
    Milestone set to 2.1
    User picture

          on Mar 06, 2012 @ 04:57pm UTC * By popsch

    We need a series of steps that lead to this behaviour.
    User picture

          on Mar 22, 2012 @ 08:13am UTC * By lrbalt

    are these todos added using your cli script, i.e. REST api?
    User picture

          on Mar 22, 2012 @ 12:16pm UTC * By popsch

    I don't remember, but I don't think so. Several local users also have the same bug and I doubt that they use the CLI script. Interestingly, the bug has since then only reappeared twice and hasn't appeared recently.
    User picture

          on Apr 08, 2012 @ 02:14pm UTC * By lrbalt

    Status changed from New to Invalid
    I'm closing this one as it is for 1.7... I'm not going to fix 1.7 :-)
    Time Expenditure
    Loading