Esempio n. 1
0
 def __renderTimeSpentOnDay(self, anEffort, dayOffset):
     ''' Return a rendered version of the duration of the effort on a
         specific day. '''
     duration = anEffort.durationDay(dayOffset) \
         if self.aggregation == 'week' else date.TimeDelta()
     return render.timeSpent(self.__round_duration(duration), 
                             showSeconds=self.__show_seconds())
Esempio n. 2
0
 def __renderTotalTimeSpent(self, anEffort):
     ''' Return a rendered version of the effort total duration (of 
         composite efforts). '''
     # No need to check for aggregation because this method is only used
     # in aggregated mode
     total_duration = anEffort.duration(recursive=True)
     return render.timeSpent(self.__round_duration(total_duration), 
                             showSeconds=self.__show_seconds())
Esempio n. 3
0
 def __renderTotalTimeSpent(self, anEffort):
     ''' Return a rendered version of the effort total duration (of 
         composite efforts). '''
     # No need to check for aggregation because this method is only used
     # in aggregated mode
     total_duration = anEffort.duration(recursive=True,
                                        rounding=self.__round_precision(),
                                        roundUp=self.__always_round_up())
     return render.timeSpent(total_duration,
                             showSeconds=self.__show_seconds())
Esempio n. 4
0
 def __renderTimeSpent(self, anEffort):
     ''' Return a rendered version of the effort duration. '''
     duration = anEffort.duration()
     # Check for aggregation because we never round in details mode
     if self.isShowingAggregatedEffort():
         duration = self.__round_duration(duration)
         showSeconds = self.__show_seconds()
     else:
         showSeconds = True
     return render.timeSpent(duration, showSeconds=showSeconds)
Esempio n. 5
0
 def __renderTimeSpentOnDay(self, anEffort, dayOffset):
     ''' Return a rendered version of the duration of the effort on a
         specific day. '''
     kwargs = dict()
     if isinstance(anEffort, effort.BaseCompositeEffort):
         kwargs['rounding'] = self.__round_precision()
         kwargs['roundUp'] = self.__always_round_up()
     duration = anEffort.durationDay(dayOffset, **kwargs) \
         if self.aggregation == 'week' else date.TimeDelta()
     return render.timeSpent(self.__round_duration(duration),
                             showSeconds=self.__show_seconds())
Esempio n. 6
0
 def __renderTimeSpentOnDay(self, anEffort, dayOffset):
     ''' Return a rendered version of the duration of the effort on a
         specific day. '''
     kwargs = dict()
     if isinstance(anEffort, effort.BaseCompositeEffort):
         kwargs['rounding'] = self.__round_precision()
         kwargs['roundUp'] = self.__always_round_up()
     duration = anEffort.durationDay(dayOffset, **kwargs) \
         if self.aggregation == 'week' else date.TimeDelta()
     return render.timeSpent(self.__round_duration(duration), 
                             showSeconds=self.__show_seconds())
Esempio n. 7
0
    def __sumTimeSpent(self, efforts):
        td = date.TimeDelta()
        for effort in efforts:
            td = td + effort.duration()

        sumTimeSpent = render.timeSpent(td, showSeconds=self.__show_seconds())
        if sumTimeSpent == '':
            if self.__show_seconds():
                sumTimeSpent = '0:00:00'
            else:
                sumTimeSpent = '0:00'
        return sumTimeSpent
Esempio n. 8
0
    def __sumTimeSpent(self, efforts):
        td = date.TimeDelta()
        for effort in efforts:
            td = td + effort.duration()

        sumTimeSpent = render.timeSpent(td, showSeconds=self.__show_seconds())
        if sumTimeSpent == '':
            if self.__show_seconds():
                sumTimeSpent = '0:00:00'
            else:
                sumTimeSpent = '0:00'
        return sumTimeSpent
Esempio n. 9
0
 def __renderTimeSpentOnDay(self, anEffort, dayOffset):
     """ Return a rendered version of the duration of the effort on a
         specific day. """
     kwargs = dict()
     if isinstance(anEffort, effort.BaseCompositeEffort):
         kwargs["rounding"] = self.__round_precision()
         kwargs["roundUp"] = self.__always_round_up()
     duration = anEffort.durationDay(dayOffset, **kwargs) if self.aggregation == "week" else date.TimeDelta()
     return render.timeSpent(
         self.__round_duration(duration),
         showSeconds=self.__show_seconds(),
         decimal=self.settings.getboolean("feature", "decimaltime"),
     )
Esempio n. 10
0
 def __renderTotalTimeSpent(self, anEffort):
     """ Return a rendered version of the effort total duration (of 
         composite efforts). """
     # No need to check for aggregation because this method is only used
     # in aggregated mode
     total_duration = anEffort.duration(
         recursive=True, rounding=self.__round_precision(), roundUp=self.__always_round_up()
     )
     return render.timeSpent(
         total_duration,
         showSeconds=self.__show_seconds(),
         decimal=self.settings.getboolean("feature", "decimaltime"),
     )
Esempio n. 11
0
 def __renderTimeSpent(self, anEffort):
     ''' Return a rendered version of the effort duration. '''
     kwargs = dict()
     if isinstance(anEffort, effort.BaseCompositeEffort):
         kwargs['rounding'] = self.__round_precision()
         kwargs['roundUp'] = self.__always_round_up()
     duration = anEffort.duration(**kwargs)
     # Check for aggregation because we never round in details mode
     if self.isShowingAggregatedEffort():
         duration = self.__round_duration(duration)
         showSeconds = self.__show_seconds()
     else:
         showSeconds = True
     return render.timeSpent(duration, showSeconds=showSeconds)
Esempio n. 12
0
 def __renderTimeSpent(self, anEffort):
     ''' Return a rendered version of the effort duration. '''
     kwargs = dict()
     if isinstance(anEffort, effort.BaseCompositeEffort):
         kwargs['rounding'] = self.__round_precision()
         kwargs['roundUp'] = self.__always_round_up()
     duration = anEffort.duration(**kwargs)
     # Check for aggregation because we never round in details mode
     if self.isShowingAggregatedEffort():
         duration = self.__round_duration(duration)
         showSeconds = self.__show_seconds()
     else:
         showSeconds = True
     return render.timeSpent(duration, showSeconds=showSeconds)
Esempio n. 13
0
    def __renderTimeSpent(self, anEffort):
        """ Return a rendered version of the effort duration. """
        kwargs = dict()
        if isinstance(anEffort, effort.BaseCompositeEffort):
            kwargs["rounding"] = self.__round_precision()
            kwargs["roundUp"] = self.__always_round_up()
        duration = anEffort.duration(**kwargs)
        # Check for aggregation because we never round in details mode
        if self.isShowingAggregatedEffort():
            duration = self.__round_duration(duration)
            showSeconds = self.__show_seconds()
        else:
            showSeconds = True

        return render.timeSpent(
            duration, showSeconds=showSeconds, decimal=self.settings.getboolean("feature", "decimaltime")
        )
Esempio n. 14
0
    def __sumTimeSpent(self, efforts):
        td = date.TimeDelta()
        for effort in efforts:
            td = td + effort.duration()

        sumTimeSpent = render.timeSpent(
            td, showSeconds=self.__show_seconds(), decimal=self.settings.getboolean("feature", "decimaltime")
        )

        if sumTimeSpent == "":
            if self.settings.getboolean("feature", "decimaltime"):
                sumTimeSpent = "0.0"
            elif self.__show_seconds():
                sumTimeSpent = "0:00:00"
            else:
                sumTimeSpent = "0:00"
        return sumTimeSpent
Esempio n. 15
0
    def __sumTimeSpent(self, efforts):
        td = date.TimeDelta()
        for effort in efforts:
            td = td + effort.duration()

        sumTimeSpent = render.timeSpent(td,
                                        showSeconds=self.__show_seconds(),
                                        decimal=self.settings.getboolean(
                                            'feature', 'decimaltime'))

        if sumTimeSpent == '':
            if self.settings.getboolean('feature', 'decimaltime'):
                sumTimeSpent = '0.0'
            elif self.__show_seconds():
                sumTimeSpent = '0:00:00'
            else:
                sumTimeSpent = '0:00'
        return sumTimeSpent
Esempio n. 16
0
 def testOneSecond(self):
     self.assertEqual('0:00:01', render.timeSpent(date.ONE_SECOND))
Esempio n. 17
0
 def testZeroTime(self):
     self.assertEqual('', render.timeSpent(date.TimeDelta()))
 def testDecimal(self):
     self.assertEqual('0.50', render.timeSpent(date.TimeDelta(minutes=30), decimal=True))
 def testDecimalNul(self):
     self.assertEqual('', render.timeSpent(date.TimeDelta(hours=0), decimal=True))
 def testDecimalNegative(self):
     self.assertEqual('-1.25', render.timeSpent(date.TimeDelta(hours=-1, minutes=-15), decimal=True))
 def testNegativeSeconds(self):
     self.assertEqual('-0:00:01', 
                      render.timeSpent(date.TimeDelta(seconds=-1)))
 def testNegativeHours(self):
     self.assertEqual('-1:00:00', 
                      render.timeSpent(date.TimeDelta(hours=-1)))
Esempio n. 23
0
 def testNegativeSeconds(self):
     self.assertEqual('-0:00:01',
                      render.timeSpent(date.TimeDelta(seconds=-1)))
Esempio n. 24
0
 def testTenHours(self):
     self.assertEqual('10:00:00',
                      render.timeSpent(date.TimeDelta(hours=10)))
Esempio n. 25
0
 def testDecimalNul(self):
     self.assertEqual(
         '', render.timeSpent(date.TimeDelta(hours=0), decimal=True))
Esempio n. 26
0
 def testNegativeHours(self):
     self.assertEqual('-1:00:00',
                      render.timeSpent(date.TimeDelta(hours=-1)))
 def testOneSecond(self):
     self.assertEqual('0:00:01', render.timeSpent(date.ONE_SECOND))
Esempio n. 28
0
 def testDecimalNegative(self):
     self.assertEqual(
         '-1.25',
         render.timeSpent(date.TimeDelta(hours=-1, minutes=-15),
                          decimal=True))
 def testTenHours(self):
     self.assertEqual('10:00:00', 
         render.timeSpent(date.TimeDelta(hours=10)))
Esempio n. 30
0
 def testDecimal(self):
     self.assertEqual(
         '0.50', render.timeSpent(date.TimeDelta(minutes=30), decimal=True))
 def testZeroTime(self):
     self.assertEqual('', render.timeSpent(date.TimeDelta()))