Closed Bug 281411 Opened 20 years ago Closed 20 years ago

The "Remaining Time" value should not be negative for too large "Hours Worked" values

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

2.19.2
defect
Not set
minor

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

Attachments

(1 file)

When the "Hours Worked" field has a value which is larger than the one in the
"Hours Left" field, a negative value is calculated and is then rejected by
ValidateTime().

To treat this case correctly, you only have to set a value of zero instead of a
negative value, see bug/edit.html.tmpl, lines 100-101:

new_time = Math.max(fRemainingTime - document.changeform.work_time.value, 0.0);

Here, I have added Math.max(..., 0.0) so that "new_time" is never negative, as
it should be.
prevent negative values for "Hours Left"...
Assignee: travis → LpSolit
Status: NEW → ASSIGNED
Attachment #173808 - Flags: review?
Comment on attachment 173808 [details] [diff] [review]
trivial patch, v1

r=wurblzap by inspection.

>      // subtracts time spent from remaining time
>      var new_time;
> 
>+     // prevent negative values if work_time > fRemainingTime

Nit: it's imho clearer if you merged the two comments, along the lines of
"substract time spent from remaining time; take care not to let that drop below
zero" or something. If you do that, please carry r+ forward.
Attachment #173808 - Flags: review? → review+
Flags: approval?
Flags: approval2.18?
Target Milestone: --- → Bugzilla 2.18
Flags: approval? → approval+
Checked in on tip:

Checking in template/en/default/bug/edit.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl,v  <--
  edit.html.tmpl
new revision: 1.55; previous revision: 1.54
done

Awaiting a+/a- on 2.18 before resolving.
Whiteboard: Checked in on 2.20: awaiting approval for 2.18
Flags: approval2.18? → approval2.18+
Checked in on 2.18.

Checking in template/en/default/bug/edit.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/bug/edit.html.tmpl,v  <--
  edit.html.tmpl
new revision: 1.40.2.6; previous revision: 1.40.2.5
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: Checked in on 2.20: awaiting approval for 2.18
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: