Modify

Opened 6 years ago

Closed 5 years ago

#4721 closed defect (fixed)

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

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

Description

For the TracHoursPlugin, you can add hours like:

i worked 7 hours

or

i worked 7.5 hours

or

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 6 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 5 years ago by k0s

  • Status changed from new to assigned

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

comment:3 Changed 5 years ago by k0s

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.