Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13152 closed defect (fixed)

add_hours_by_comment is inconsistent in the way to record muitple time records in a single comment

Reported by: EmeCas Owned by: EmeCas
Priority: normal Component: TracHoursPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description

Problem:

Using an expression like this in the body of a comment:

1 hour 1 hour Description

would result in a single time record to be created.

while using expressions like these as a comment:

1 hour . 1 hour Description 1 hours 1 hours Description 1.5 hours 1 hours Description

Would result in 2 time records to be created by each comment.

For a more complex expression like this:

1 hour 1 hour 2 hours 1 hour 1 hour 1.5 hours 0.5 hours 1 hour 1 hour {5/1/2016} Description

It records

  • 1 hour
  • 2 hours
  • 1 hour
  • 1.5 hours
  • 0.5 hours
  • 1 hour

Missing 3 records

  • 1 hour
  • 1 hour
  • 1 hour

The problem is related to consecutive 1 hour expressions without space(s) or text in between, where the result matching by the current regular expression is failing.

Solution:

The current regular expression has to be updated from:

# for singular hours: 1 hour
singular_hour_regex = r'((^)|(\s))1 *hour((\W)|($))'

to

# for singular hours: 1 hour
singular_hour_regex = r'((^)|(\s*))1 *hour((\W)|($))'

Attachments (1)

patch13152 (643 bytes) - added by EmeCas 7 years ago.
Fixing Regular Expression

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by EmeCas

Attachment: patch13152 added

Fixing Regular Expression

comment:1 Changed 7 years ago by Ryan J Ollos

Owner: set to EmeCas
Status: newassigned

You are now maintainer of the plugin. Feel free to commit the change.

comment:2 Changed 7 years ago by Ryan J Ollos

Also, feel free to CC me on any tickets if you have questions about development or specifically about the plugin. I've done a fair bit of work on the plugin.

comment:3 Changed 7 years ago by EmeCas

Resolution: fixed
Status: assignedclosed

Change committed on Revision 16555

comment:4 in reply to:  2 Changed 7 years ago by EmeCas

Thanks

Replying to Ryan J Ollos:

Also, feel free to CC me on any tickets if you have questions about development or specifically about the plugin. I've done a fair bit of work on the plugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain EmeCas.
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.