Modify

Opened 18 months ago

Last modified 18 months ago

#11206 new enhancement

Initialize stopwatch with the value of the text field

Reported by: xoneca@… Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

When you press preview, the elapsed time is present in the text field, but the stopwatch resets to zero.

If I want to continue working without committing the message, I have to sum the value of the stopwatch with the value from the text field.

I tried to do myself a patch because seemed trivial, but couldn't do the part of initialize the stopwatch timer with the value of the field without breaking encapsulation.

Attachments (0)

Change History (5)

comment:1 Changed 18 months ago by bobbysmith007

Honestly I have never used the stop watch. It was a patch submitted by someone, and I could find no reason not to include it so I did.

Looking at the code, I can see why you are having some issues with it, as it seems overly complex and a bit convoluted.

It seems like for this to work, you would want to store the watch start time for a given ticket in some client accessible location (localstorage / cookie), or submit it to the server and back (which seemed to be your idea).

I would not be opposed to a fresh rewrite of this code with a more modern approach if you are motivated. Otherwise, feel free to decapsulate the code so you have access to variables needed (can be as simple as window.stopwatch = stopwatch, or what have you). Also feel free to modify the code inside of encapsulation.

Thanks for taking the time to file this bug report. I can see how the described behavior would annoy. If I get a chance in the next little bit I may try and tackle this if you have not made further progress, so please do update this ticket if you work on it (even if its just code sketches).

comment:2 Changed 18 months ago by bobbysmith007

Also I am not sure what "the elapsed time is present in the text field" means. I do not see the elapsed time anywhere (unless you are referring to the time since the last comment (which may or may not be the elapsed time related to the stopwatch).

Last edited 18 months ago by bobbysmith007 (previous) (diff)

comment:3 follow-up: Changed 18 months ago by bobbysmith007

Ideas for a better stopwatch from my brief interaction:

  • no hide/unhide stuff, just show the stop watch if it is enabled, ( you can turn of this component via !admin / trac.ini, so lets not bother with a second layer of hiding)
  • make the "use stopwatch value" and "reset" buttons always be visible, while toggling the pause/unpause button
  • Store the stopwatch start time per ticket in client or server state, so that we can ensure that previewing (and preferably following a link on a ticket) doesn't lose all your time.

comment:4 Changed 18 months ago by xOneca <xoneca@…>

It seems like for this to work, you would want to store the watch start time for a given ticket in some client accessible location (localstorage / cookie), or submit it to the server and back (which seemed to be your idea).

Also I am not sure what "the elapsed time is present in the text field" means.

I mean the Add Hours to Ticket text box.

The part of sending to the server and back is already done in the current implementation, so I was thinking on just reading the text box value with Javascript. Maybe it's not as persistent as a cookie, but it works even if you close the tab (happens too often to me) and you reopen (undo) it. (At least in FF, if you have pressed preview)

comment:5 in reply to: ↑ 3 Changed 18 months ago by xOneca <xoneca@…>

Replying to bobbysmith007:

Ideas for a better stopwatch from my brief interaction:

  • no hide/unhide stuff, just show the stop watch if it is enabled, ( you can turn of this component via !admin / trac.ini, so lets not bother with a second layer of hiding)
  • make the "use stopwatch value" and "reset" buttons always be visible, while toggling the pause/unpause button

Agree with both, but I am used to it so no problem to me.

  • Store the stopwatch start time per ticket in client or server state, so that we can ensure that previewing (and preferably following a link on a ticket) doesn't lose all your time.

This is what I am trying to address, so agree too.

Add Comment

Modify Ticket

Action
as new The owner will remain bobbysmith007.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.