Example #1
0
 def print(self):
     self.simple_summary.print()
     p = Printer()
     p.newline()
     p.add_header("Total Time Logged Per Project")
     p.newline()
     graph = (
         SummaryGraph(self.project_time_map)
         .set_max_width(utils.max_width(self.config.get_max_graph_width()))
         .set_key_transform_function(self.config.get_project_name)
         .sort_graph(reverse=True)
         .generate()
     )
     for row in graph:
         p.add_nowrap(row)
     p.newline()
     p.add_header("Total Time Logged Per Area Per Project")
     p.newline()
     multigraph = (
         SummaryMultiGraph(self.project_area_time_map, 30)
         .set_header_transform_function(self.config.get_project_name)
         .generate()
     )
     for row in multigraph:
         p.add_nowrap(row)
     p.print()
Example #2
0
    def print(self):
        self.simple_summary.print()
        p = Printer()
        p.newline()
        p.add_header(f"Summary For {self.area_name}")
        p.newline()

        minimum = None
        maximum = None
        average = datetime.timedelta()

        for entry in self.area_time_map[self.area]:
            if minimum is None or minimum > entry:
                minimum = entry
            if maximum is None or maximum < entry:
                maximum = entry
            average += entry

        average = average / len(self.area_time_map[self.area])

        p.add(
            f"The lowest recorded entry for {self.area_name} is ",
            f"{utils.format_time_delta(minimum)}.",
        )
        p.add(
            f"The highest recorded entry for {self.area_name} is ",
            f"{utils.format_time_delta(maximum)}.",
        )
        p.add(
            f"The average entry for {self.area_name} is ",
            f"{utils.format_time_delta(average)}.",
        )

        p.newline()
        p.add_header(f"Entry Time Distribution for {self.area_name}")
        p.newline()
        box = (BoxPlot(self.area_time_map).set_max_width(
            utils.max_width(self.config.get_max_graph_width())
        ).set_exclude_list(
            self.config.get_exclude_from_entry_time_distribution()).generate())
        for row in box:
            p.add_nowrap(row)
        p.newline()
        p.add_header("LAST {0} ENTRIES".format(len(self.last_entries)))
        p.newline()
        for entry in self.last_entries:
            if self.config.get_use_wending():
                start_date = entry.start.strftime("{daeg} {month} {gere}")
            else:
                start_date = entry.start.strftime("%d %b %Y")
            p.add(*utils.get_rendered_string(
                entry.area,
                self.config.get_area(entry.area),
                start_date,
                self.config.get_object_name(entry.area, entry.obj),
                utils.time_diff(entry.start, entry.end),
                entry.purpose,
            ))
        p.print()
Example #3
0
 def print(self):
     self.simple_summary.print()
     p = Printer()
     p.newline()
     p.add_header("Total Time Logged Per Area")
     p.newline()
     # Sum all the timedeltas for the summary graph
     summary_time_map = dict(
         map(
             lambda x: (x[0], sum(x[1], datetime.timedelta())),
             self.area_time_map.items(),
         )
     )
     graph = (
         SummaryGraph(summary_time_map)
         .set_max_width(utils.max_width(self.config.max_graph_width))
         .set_exclude_list(self.config.exclude_from_total_time)
         .generate()
     )
     for row in graph:
         p.add_nowrap(row)
     p.newline()
     p.add_header("ENTRY TIME DISTRIBUTION PER AREA")
     p.newline()
     box = (
         BoxPlot(self.area_time_map)
         .set_max_width(utils.max_width(self.config.max_graph_width))
         .set_exclude_list(self.config.exclude_from_entry_time_distribution)
         .generate()
     )
     for row in box:
         p.add_nowrap(row)
     p.newline()
     p.add_header("LAST {0} ENTRIES".format(len(self.last_entries)))
     p.newline()
     for entry in self.last_entries:
         if self.config.use_wending:
             start_date = entry.start.strftime("{daeg} {month} {gere}")
         else:
             start_date = entry.start.strftime("%d %b %Y")
         p.add(
             *utils.get_rendered_string(
                 entry.area,
                 self.config.get_area(entry.area),
                 start_date,
                 self.config.get_object_name(entry.area, entry.obj),
                 utils.time_diff(entry.start, entry.end),
                 entry.purpose,
             )
         )
     p.print()
Example #4
0
    def print(self):
        self.simple_summary.print()
        p = Printer()

        def day_num_to_string(day_num):
            dates = {
                0: "MON",
                1: "TUE",
                2: "WED",
                3: "THU",
                4: "FRI",
                5: "SAT",
                6: "SUN",
            }
            return dates[day_num]

        def zero_pad_hour(hour):
            if len(str(hour)) == 1:
                return "0{}".format(str(hour))

            return str(hour)

        p.newline()
        p.add_header("Total Time Logged Per Day")
        p.newline()
        graph = (SummaryGraph(self.day_delta_map).set_max_width(
            utils.max_width(
                self.config.max_graph_width)).set_key_transform_function(
                    day_num_to_string).generate())
        for row in graph:
            p.add_nowrap(row)
        p.newline()
        p.add_header("Total time logged per hour")
        p.newline()
        graph = (SummaryGraph(self.hour_delta_map).set_max_width(
            utils.max_width(
                self.config.max_graph_width)).set_key_transform_function(
                    zero_pad_hour).generate())
        for row in graph:
            p.add_nowrap(row)
        p.print()