Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9281 closed defect (worksforme)

Tickets have always duration of 1 day and milestone has a start date 2 days after due date

Reported by: anonymous Owned by: ChrisNelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Hello,

i was installing and testing this great plugin!
but i have two issues:

  • the tickets are always 1 day in duration, and end on the finish date, regardless the start date.
  • the milestone is shown as MS:xxx, and has an assosiated start date two days after its due date.

I attached a picture where you can see this. Maybe I'm just missing a configuration issue or somewhat.

My trac.ini has the following config for the important fields:

[ticket-custom]
blockedby = text
blockedby.label = Wird blockiert durch
blocking = text
blocking.label = Blockiert was?
userfinish = text
userfinish.date = true
userfinish.date_empty = true
userfinish.label = Deadline
userstart = text
userstart.date = true
userstart.date_empty = true
userstart.label = Beginn

[datefield]
first_day = 1
format = ymd
separator = -

[trac-jsgantt]
date_format = %Y-%m-%d
fields.start = userstart
fields.finish = userfinish
fields.pred = blockedby
fields.succ = blocking
milestone_type =

Thank you for your help!
Sincerely,

Andreas

Attachments (1)

fehler.png (13.1 KB) - added by anonymous 3 years ago.

Download all attachments as: .zip

Change History (7)

Changed 3 years ago by anonymous

comment:1 Changed 3 years ago by Andreas

I should add that i have not installed the TimingAndEstimationPlugin, so I think worked hours are not appliable. The Plugin should just use the provided dates.
(see #9279 and #8786)

comment:2 Changed 3 years ago by anonymous

What is the data of both tickets 'erstes' and 'zweites'? Do they have start and end dates?

comment:3 Changed 3 years ago by Andreas

Yes the do.
I checked that the fields are set correctly, if not jsGanttPlugin raises errors field not defined or a date format error.

comment:4 Changed 3 years ago by Andreas

  • Resolution set to worksforme
  • Status changed from new to closed

I have a fix for those without using working hours. Tickets will be displayed only according to their start and finish dates.
The issue that the milestone's begin date is one day after the end date will not be fixed. I don't understand really because it is set to be equal!?

Fix:

--- tracjsgantt/tracjsgantt.stock.py 2011-10-21 15:49:27.572861346 +0200
+++ tracjsgantt/tracjsgantt.py 2011-10-21 15:57:35.696662703 +0200
@@ -508,6 +508,24 @@

# If the task was estimated, use that number
elif self.fieldsestimate? and (est != 0):

est = float(ticket[self.fieldsestimate?])

+ #Andreas Resch: If the task has no estimate but start and end dates
+ elif (est == None) and ticket.get(self.fieldsstart?) and ticket.get(self.fieldsfinish?):
+ if ticket[self.fieldsstart?] != :
+ start = datetime(*time.strptime(ticket[self.fieldsstart?], self.dbDateFormat)[0:7])
+ else:
+ start = datetime.today().date()
+ start = start.replace(hour=0, minute=0)
+ if ticket[self.fieldsfinish?] !=
:
+ finish = datetime(*time.strptime(ticket[self.fieldsfinish?], self.dbDateFormat)[0:7])
+ finish = finish.replace(hour=0, minute=0)
+ # if start and finish defined
+ if start and finish:
+ diff = finish - start
+ days = diff.days+1
+ est = days / self.dpe
+ if (est == None) or (est == 0):
+ # fallback to default estimate
+ est = self.dftEst

# Otherwise, use the default estimate
else:

est = self.dftEst

@@ -613,6 +631,8 @@

self.dbDateFormat)[0:7])

finish = finish.replace(hour=0, minute=0) + \

timedelta(hours=self.hpd)

+ #Andreas Resch: align boxes to end of day if finish is used
+ shift = 1

# Otherwise, compute finish from dependencies.
else:

finish = _earliest_successor(t, _ancestor_finish(t))

@@ -640,6 +660,10 @@

# start is finish minus duration
hours = self._workHours(t)
start = finish + _calendarOffset(-1*hours, finish)

+ #Andreas Resch: align boxes to end of day
+ if (shift == 1):
+ finish = finish + timedelta(days=1)
+ start += timedelta(days=1)

# Set the fields
tcalc_finish? = finish

@@ -694,6 +718,8 @@

start = datetime(*time.strptime(t[self.fieldsstart?],

self.dbDateFormat)[0:7])

start = start.replace(hour=0, minute=0)

+ #Andreas Resch: align boxes to end of day if finish is used
+ shift = 1

# Otherwise, compute start from dependencies.
else:

start = _latest_predecessor(t, _ancestor_start(t))

@@ -723,6 +749,10 @@

hours = self._workHours(t)
finish = start + _calendarOffset(+1*hours, start)


+ #Andreas Resch: align boxes to end of day
+ if (shift == 1):
+ finish = finish + timedelta(days=1)
+ start += timedelta(days=1)

# Set the fields
tcalc_finish? = finish
tcalc_start? = start

@@ -1115,4 +1145,3 @@

chart += self._end_gantt(options)


return chart

-

comment:5 Changed 3 years ago by anonymous

--- tracjsgantt/tracjsgantt.stock.py	2011-10-21 15:49:27.572861346 +0200
+++ tracjsgantt/tracjsgantt.py	2011-10-21 15:57:35.696662703 +0200
@@ -508,6 +508,24 @@
         # If the task was estimated, use that number
         elif self.fields['estimate'] and (est != 0):
             est = float(ticket[self.fields['estimate']])
+        #Andreas Resch: If the task has no estimate but start and end dates
+        elif (est == None) and ticket.get(self.fields['start']) and ticket.get(self.fields['finish']):
+            if ticket[self.fields['start']] != '':
+                start = datetime(*time.strptime(ticket[self.fields['start']], self.dbDateFormat)[0:7])
+            else:
+                start = datetime.today().date()
+            start = start.replace(hour=0, minute=0)
+            if ticket[self.fields['finish']] != '':
+                finish = datetime(*time.strptime(ticket[self.fields['finish']], self.dbDateFormat)[0:7])
+                finish = finish.replace(hour=0, minute=0)
+            # if start and finish defined
+            if start and finish:
+                diff = finish - start
+                days = diff.days+1
+                est = days / self.dpe
+            if (est == None) or (est == 0):
+                # fallback to default estimate
+                est = self.dftEst
         # Otherwise, use the default estimate
         else:
             est = self.dftEst
@@ -613,6 +631,8 @@
                                                      self.dbDateFormat)[0:7])
                     finish = finish.replace(hour=0, minute=0) + \
                         timedelta(hours=self.hpd)
+                    #Andreas Resch: align boxes to end of day if finish is used
+                    shift = 1
                 # Otherwise, compute finish from dependencies.
                 else:
                     finish = _earliest_successor(t, _ancestor_finish(t))
@@ -640,6 +660,10 @@
                 # start is finish minus duration
                 hours = self._workHours(t)
                 start = finish + _calendarOffset(-1*hours, finish)
+                #Andreas Resch: align boxes to end of day
+                if (shift == 1):
+                    finish = finish + timedelta(days=1)
+                    start += timedelta(days=1)
 
                 # Set the fields
                 t['calc_finish'] = finish
@@ -694,6 +718,8 @@
                     start = datetime(*time.strptime(t[self.fields['start']], 
                                                      self.dbDateFormat)[0:7])
                     start = start.replace(hour=0, minute=0)
+                    #Andreas Resch: align boxes to end of day if finish is used
+                    shift = 1
                 # Otherwise, compute start from dependencies.
                 else:
                     start = _latest_predecessor(t, _ancestor_start(t))
@@ -723,6 +749,10 @@
                 hours = self._workHours(t)
                 finish = start + _calendarOffset(+1*hours, start)
 
+                #Andreas Resch: align boxes to end of day
+                if (shift == 1):
+                    finish = finish + timedelta(days=1)
+                    start += timedelta(days=1)
                 # Set the fields
                 t['calc_finish'] = finish
                 t['calc_start'] = start
@@ -1115,4 +1145,3 @@
             chart += self._end_gantt(options)
 
         return chart
-

comment:6 Changed 3 years ago by Andreas

Sorry for that many posts, final patch for me:

--- tracjsgantt/tracjsgantt.stock.py	2011-10-21 15:49:27.572861346 +0200
+++ tracjsgantt/tracjsgantt.py	2011-10-21 19:25:18.398668511 +0200
@@ -508,6 +508,24 @@
         # If the task was estimated, use that number
         elif self.fields['estimate'] and (est != 0):
             est = float(ticket[self.fields['estimate']])
+        #Andreas Resch: If the task has no estimate but start and end dates
+        elif (est == None) and ticket.get(self.fields['finish']):
+            if ticket[self.fields['start']] != '':
+                start = datetime(*time.strptime(ticket[self.fields['start']], self.dbDateFormat)[0:7])
+            else:
+                start = datetime.today()
+            start = start.replace(hour=0, minute=0)
+            if ticket[self.fields['finish']] != '':
+                finish = datetime(*time.strptime(ticket[self.fields['finish']], self.dbDateFormat)[0:7])
+                finish = finish.replace(hour=0, minute=0)
+            # if start and finish defined
+            if finish:
+                diff = finish - start
+                days = diff.days+1
+                est = days / self.dpe
+            if (est == None) or (est == 0):
+                # fallback to default estimate
+                est = self.dftEst
         # Otherwise, use the default estimate
         else:
             est = self.dftEst
@@ -613,8 +631,11 @@
                                                      self.dbDateFormat)[0:7])
                     finish = finish.replace(hour=0, minute=0) + \
                         timedelta(hours=self.hpd)
+                    #Andreas Resch: align boxes to end of day if finish is used
+                    shift = 1
                 # Otherwise, compute finish from dependencies.
                 else:
+                    shift = 0
                     finish = _earliest_successor(t, _ancestor_finish(t))
                     
                     # If dependencies don't give a date, default to
@@ -640,6 +661,10 @@
                 # start is finish minus duration
                 hours = self._workHours(t)
                 start = finish + _calendarOffset(-1*hours, finish)
+                #Andreas Resch: align boxes to end of day
+                if shift:
+                    finish = finish + timedelta(days=1)
+                    start += timedelta(days=1)
 
                 # Set the fields
                 t['calc_finish'] = finish
@@ -694,8 +719,11 @@
                     start = datetime(*time.strptime(t[self.fields['start']], 
                                                      self.dbDateFormat)[0:7])
                     start = start.replace(hour=0, minute=0)
+                    #Andreas Resch: align boxes to end of day if finish is used
+                    shift = 1
                 # Otherwise, compute start from dependencies.
                 else:
+                    shift = 0
                     start = _latest_predecessor(t, _ancestor_start(t))
                     
                     # If dependencies don't give a date, default to today
@@ -723,6 +751,10 @@
                 hours = self._workHours(t)
                 finish = start + _calendarOffset(+1*hours, start)
 
+                #Andreas Resch: align boxes to end of day
+                if shift:
+                    finish = finish + timedelta(days=1)
+                    start += timedelta(days=1)
                 # Set the fields
                 t['calc_finish'] = finish
                 t['calc_start'] = start
@@ -1115,4 +1147,3 @@
             chart += self._end_gantt(options)
 
         return chart
-

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.