Output the number of modified rows each period in the timeline module.

This will output the sum of changed rows from all the authors of that
period.
This commit is contained in:
Adam Waldenberg 2013-04-09 10:43:04 +02:00
parent 32c3b5af9f
commit 287d7211ee
1 changed files with 14 additions and 1 deletions

View File

@ -61,6 +61,9 @@ class TimelineData:
def get_periods(self):
return sorted(set([i[1] for i in self.entries]))
def get_total_changes_in_period(self, period):
return self.total_changes_by_period[period]
def get_authors(self):
return sorted(set([i[0] for i in self.entries]))
@ -112,6 +115,14 @@ def __output_row__text__(timeline_data, periods, names):
len(signs_str) == 0 else signs_str).rjust(10), end=" ")
print("")
print(terminal.__bold__ + "Modified Rows:".ljust(20) + terminal.__normal__, end=" ")
for period in periods:
total_changes = timeline_data.get_total_changes_in_period(period)
print("" + str(total_changes[2]).rjust(10), end=" ")
print("")
class Timeline(Outputable):
def __init__(self, changes, useweeks):
self.changes = changes
@ -157,6 +168,8 @@ class Timeline(Outputable):
authors_xml += "\t\t\t\t</authors>\n"
timeline_xml += "\t\t\t<period>\n" + name_xml + authors_xml + "\t\t\t</period>\n"
modified_rows_xml = "\t\t\t\t<modified_rows>" + \
str(timeline_data.get_total_changes_in_period(period)[2]) + "</modified_rows>\n"
timeline_xml += "\t\t\t<period>\n" + name_xml + authors_xml + modified_rows_xml + "\t\t\t</period>\n"
print("\t<timeline>\n" + message_xml + periods_xml + timeline_xml + "\t\t</periods>\n\t</timeline>")