Exemplo n.º 1
0
    def __init__(self, date, text=None, date_format='%d.%m.%Y'):
        self.date = date

        if text is not None:
            self.text = text
        else:
            self.text = date_utils.unicode_strftime(self.date, date_format)
Exemplo n.º 2
0
    def non_working_dates_commit_error(self, dates):
        dates = [date_utils.unicode_strftime(d, '%A %d %B') for d in dates]

        self.err(u"You're trying to commit for a day that's "
                 " on a week-end or that's not yesterday nor today (%s).\n"
                 "To ignore this error, re-run taxi with the option "
                 "`--ignore-date-error`" % ', '.join(dates))
Exemplo n.º 3
0
    def show_status(self, entries_dict, alias_mappings, settings):
        self.msg(u'Staging changes :\n')
        entries_list = entries_dict.items()
        entries_list = sorted(entries_list)
        total_hours = 0

        for (date, entries) in entries_list:
            if len(entries) == 0:
                continue

            subtotal_hours = 0
            # The encoding of date.strftime output depends on the current
            # locale, so we decode it to get a unicode string
            self.msg(u'# %s #' % date_utils.unicode_strftime(
                date, '%A %d %B').capitalize())
            for entry in entries:
                self.msg(self.get_entry_status(entry, alias_mappings))

                if (not entry.is_ignored()
                        and entry.alias not in alias_mappings):
                    close_matches = settings.get_close_matches(entry.alias)
                    if close_matches:
                        self.msg(u'\tDid you mean one of the following: %s?' %
                                 ', '.join(close_matches))

                if (entry.alias not in alias_mappings
                        or not alias_mappings.is_local(entry.alias)):
                    subtotal_hours += entry.hours or 0

            self.msg(u'%-29s %5.2f\n' % ('', subtotal_hours))
            total_hours += subtotal_hours

        self.msg(u'%-29s %5.2f' % ('Total', total_hours))
        self.msg(u'\nUse `taxi ci` to commit staging changes to the server')
Exemplo n.º 4
0
    def show_status(self, entries_dict):
        self.msg(u'Staging changes :\n')
        entries_list = entries_dict.items()
        entries_list = sorted(entries_list)
        total_hours = 0

        for (date, entries) in entries_list:
            if len(entries) == 0:
                continue

            subtotal_hours = 0
            # The encoding of date.strftime output depends on the current
            # locale, so we decode it to get a unicode string
            self.msg(u'# %s #' %
                     date_utils.unicode_strftime(date, '%A %d %B').capitalize())
            for entry in entries:
                self.msg(unicode(entry))
                subtotal_hours += entry.get_duration() or 0

            self.msg(u'%-29s %5.2f\n' % ('', subtotal_hours))
            total_hours += subtotal_hours

        self.msg(u'%-29s %5.2f' % ('Total', total_hours))
        self.msg(u'\nUse `taxi ci` to commit staging changes to the server')