Opened 13 years ago
Closed 13 years ago
#9445 closed enhancement (fixed)
[Patch] The custom fields for start and end date should be required
Reported by: | Ryan J Ollos | Owned by: | Chris Nelson |
---|---|---|---|
Priority: | normal | Component: | TracJsGanttPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
It seems like all of the custom fields are optional except for start and finish. Is there any use case or utility of the chart if these aren't defined? If not, and we checked for and threw an error when they aren't defined, it would be safe to omit checks such as if self.fields['start']
.
This will lead into some other refactoring ideas I would like to discuss later on, in order to improve the robustness of the code.
-
0.11/tracjsgantt/tracjsgantt.py
183 183 for field in fields: 184 184 self.fields[field] = self.config.get('trac-jsgantt', 185 185 'fields.%s' % field) 186 187 # Check for required fields 188 if not self.fields['start']: 189 raise TracError("""The custom field for start date must 190 be configured in trac.ini.""") 191 192 if not self.fields['finish']: 193 raise TracError("""The custom field for end date must 194 be configured in trac.ini.""") 186 195 187 196 # This is the format of start and finish in the Trac database 188 197 self.dbDateFormat = str(self.config.get('trac-jsgantt', 'date_format'))
Attachments (0)
Change History (6)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Summary: | The custom fields for start and end date should be required → [Patch] The custom fields for start and end date should be required |
---|
comment:4 Changed 13 years ago by
Status: | new → assigned |
---|
Replying to rjollos:
It seems like all of the custom fields are optional except for start and finish. Is there any use case or utility of the chart if these aren't defined?
Sure. Those fields just allow the user to specify explicit start and/or finish dates for tasks. Without them you could have a Trac milestone with a due date and tickets leading up to it (with dependencies between them) which flow back ALAP to a necessary start date.
...
I'm not sure if you're saying that the chart currently misbehaves if these fields aren't configured. I'll test that. If there is a place I'm requiring them by not testing for existence, I'll plan to fix that.
comment:5 Changed 13 years ago by
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This works for me and I've heard no complaints in over a week.
Two of the thoughts I had about refactoring were:
_process_tickets
should have a consistent set of keys. If we mapped, for example,t[self.fields['estimate']] -> t['estimate']
, we could avoid the need for the repetitive and verbose checks such as the following, which have resulted in a number of bugs:if self.fields['estimate'] and ticket.get(self.fields['estimate']):
.None
. That way, the only check that ever needs to be done isif ticket['estimate']: