Opened 8 years ago

Closed 8 years ago

#4721 closed defect (fixed)

can't add hours via comments when the hour is singular ("1 hour")

Reported by: Jeff Hammel Owned by: Jeff Hammel
Priority: normal Component: TracHoursPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


For the TracHoursPlugin, you can add hours like:

i worked 7 hours


i worked 7.5 hours


i worked 1:30 hours

However, you cannot add singular hours:

i worked 1 hour

I punted on this b/c the regex is either more complicated or more than one pass is needed.

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by Merola64

If I understand the problem correctly, the regex needs to match <amount of time> hours as well as <amount of time> hour.

Currently the regex is:

hours_regex = '(([0-9]+(\.[0-9]+)?)|([0-9]+:[0-5][0-9])) *hours'

Changing it to this would (in additon to the existing matches) match "1 hour" (as well as "2 hour", "1:30 hour" and "7.5 hour"):

hours_regex = '(([0-9]+(\.[0-9]+)?)|([0-9]+:[0-5][0-9])) *hours?'

Unsure if it is that simple or if you are looking for something else :)

comment:2 Changed 8 years ago by Jeff Hammel

Status: newassigned

I feel better enforcing people to use "1 hours" for now instead of supporting "7 hour", etc.

comment:3 Changed 8 years ago by Jeff Hammel

Resolution: fixed
Status: assignedclosed

(In [5379]) support for singular hours in comments ("1 hour"); fixes #4721, but note that the code is brittle

Modify Ticket

as closed The owner will remain Jeff Hammel.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

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

Note: See TracTickets for help on using tickets.