fernandokosh / redmine_time_tracker

A time tracker plugin for Redmine
Other
203 stars 141 forks source link

Error on starting multiple timers #45

Closed sayyid closed 13 years ago

sayyid commented 13 years ago

Hi! First of all: thanks for this great plugin! I encountered an error when starting multiple timers (i.e. starting a timer (in an already opened tab) when another timer (in another tab) was started before). This was the AJAX request result:

...

Template is missing

Missing template time_trackers/start.erb in view path ...

...

To reproduce this: (maybe you should raise the refresh rate to be able to reproduce this bug)

  1. Open 2 tabs, each with a different issue on it (or the same issue, it doesn't matter)
  2. Start a timer in the first tab
  3. Switch to the other tab (before it is refreshed and the started timer is displayed) and start the second timer

This also happens if you pause a timer on a tab, and start another timer in a separate tab before it's refreshed to reflect the paused timer.

My redmine: Bitnami redmine stack, 1.1.0.devel The plugin version is 0.4.

Thanks in advance!

edit: Pausing a timer two times (in two separate tabs) or starting a paused timer two times will also result in a corrupt page with the "Loading..." remaining at the middle of the page. The AJAX result in these cases are a whole HTML page, which is inserted into the menu and corrupt it. In these cases, when the menu is refreshed, the page is OK, only the "Loading..." remains in the page!

Stopping a timer two times doesn't corrupt anything, because the stop button is a link to another page and is not an AJAX button.

delaitre commented 13 years ago

Well, you're not supposed to do that! (I mean, running several time trackers at the same time is a feature not implemented yet)

However, I don't know what I can do. If you start a tracker, and before the refresh rate times out you start a new one in another tab, then what I'm supposed to do? If I display the time tracker already running, you'll think the second start is ok while it's not.

The better solution is, I think, do avoid such use case... When several time trackers will be allowed, I think I'll just pause the first one and run the second, but this is not crystal clear for the user.

sayyid commented 13 years ago

You've already put code for detecting this use-case: (controllers/time_tracker_controller.rb: TimeTrackersController.start@16)

        if @time_tracker.nil?
...
        else
            flash[:error] = l(:time_tracker_already_running_error)
        end

I didn't mean to have multiple time trackers running! I think you should display an error via javascript to the user in this case, not via "flash[:error]".

I'm not a ruby developer, and didn't code for redmine, so I don't know whether this (displaying a javascript error) is possible.

delaitre commented 13 years ago

Ok, this is related to #7 so. Indeed, there is very few error handling right now as I don't really know what to do... Maybe we could display an error message for a while next to the time tracker or something like that.

Anyway, it will demand some work and I don't have time right now...

sayyid commented 13 years ago

Yes that's the same problem! Should I close this issue?

delaitre commented 13 years ago

I close it.