|
|
@@ -758,26 +758,27 @@ class HTMLReportCreator(ReportCreator):
|
|
758
|
758
|
|
|
759
|
759
|
# New function for TSV write ins, put this in a more organized place later
|
|
760
|
760
|
|
|
761
|
|
- def writeHeaderstoNewTSV(fileName,headers):
|
|
|
761
|
+ def writeHeaderstoNewFile(fileName,headers, delimiter):
|
|
762
|
762
|
"""
|
|
763
|
|
- Writes the headers to the first line of the .tsv file
|
|
|
763
|
+ Writes the headers to the first line of the file
|
|
764
|
764
|
|
|
765
|
765
|
Args:
|
|
766
|
766
|
fileName (String): Name of the destination file, ex: "data.tsv"
|
|
767
|
767
|
headers (List(String)): Headers to be written, ex: ["header1","header2"....]
|
|
768
|
768
|
|
|
769
|
769
|
"""
|
|
770
|
|
- assert fileName[-4:] ==".tsv", "fileName must be '.tsv' file not '%s'" %(fileName)
|
|
|
770
|
+ # assert fileName[-4:] ==".tsv", "fileName must be '.tsv' file not '%s'" %(fileName)
|
|
771
|
771
|
|
|
772
|
772
|
f = open (fileName,"w")
|
|
773
|
773
|
for headerIndex in range(len(headers)):
|
|
774
|
774
|
if headerIndex!=len(headers)-1:
|
|
775
|
775
|
# write header along with\t
|
|
776
|
|
- f.write(headers[headerIndex]+"\t")
|
|
|
776
|
+ f.write(headers[headerIndex]+delimiter)
|
|
777
|
777
|
else:
|
|
778
|
778
|
# write last word along with\n
|
|
779
|
779
|
f.write(headers[len(headers)-1]+"\n")
|
|
780
|
780
|
f.close()
|
|
|
781
|
+
|
|
781
|
782
|
|
|
782
|
783
|
self.printNav(f)
|
|
783
|
784
|
|
|
|
@@ -812,10 +813,10 @@ class HTMLReportCreator(ReportCreator):
|
|
812
|
813
|
f.write(html_header(2, 'Weekly activity'))
|
|
813
|
814
|
f.write('<p>Last %d weeks</p>' % WEEKS)
|
|
814
|
815
|
|
|
815
|
|
- writeHeaderstoNewTSV(path + "/day_of_week_TEST.tsv", ['day_number','day_name','commits'])
|
|
|
816
|
+ writeHeaderstoNewFile(path + "/day_of_week_TEST.tsv", ['day_number','day_name','commits'],"\t")
|
|
816
|
817
|
day_of_week_tsv=open(path + "/day_of_week_TEST.tsv", "a+")
|
|
817
|
818
|
|
|
818
|
|
- writeHeaderstoNewTSV(path + "/weekly_actvitity_TEST.tsv", ['days, commits'])
|
|
|
819
|
+ writeHeaderstoNewFile(path + "/weekly_actvitity_TEST.tsv", ['days, commits'], "\t")
|
|
819
|
820
|
|
|
820
|
821
|
# generate weeks to show (previous N weeks from now)
|
|
821
|
822
|
now = datetime.datetime.now()
|
|
|
@@ -885,8 +886,11 @@ class HTMLReportCreator(ReportCreator):
|
|
885
|
886
|
|
|
886
|
887
|
# Day of Week
|
|
887
|
888
|
|
|
888
|
|
- writeHeaderstoNewTSV(path + "/day_of_week_TEST.tsv", ['day_number','day_name','commits'])
|
|
|
889
|
+ writeHeaderstoNewFile(path + "/day_of_week_TEST.tsv", ['day_number','day_name','commits'],"\t")
|
|
889
|
890
|
day_of_week_tsv=open(path + "/day_of_week_TEST.tsv", "a+")
|
|
|
891
|
+ FOR TABLE OUTPUT, NEED TO TEST THIS
|
|
|
892
|
+ writeHeaderstoNewFile(path +"/day_of_week_TABLE.csv". ['Day','Total', 'Percentage', ','])
|
|
|
893
|
+ day_of_week_TABLE=open(path + "/day_of_week_TABLE.csv", "a+")
|
|
890
|
894
|
|
|
891
|
895
|
f.write(html_header(2, 'Day of Week'))
|
|
892
|
896
|
day_of_week = data.getActivityByDayOfWeek()
|
|
|
@@ -900,6 +904,7 @@ class HTMLReportCreator(ReportCreator):
|
|
900
|
904
|
fp.write('%d %s %d\n' % (d + 1, WEEKDAYS[d], commits))
|
|
901
|
905
|
# WRITE TO TSV, add +1, may cause off by one err
|
|
902
|
906
|
day_of_week_tsv.write("%d\t%s\t%d\n" %(d+1, WEEKDAYS[d],commits))
|
|
|
907
|
+ day_of_week_TABLE.write("%d,%s,%d\n" %(d+1, WEEKDAYS[d],commits))
|
|
903
|
908
|
f.write('<tr>')
|
|
904
|
909
|
f.write('<th>%s</th>' % (WEEKDAYS[d]))
|
|
905
|
910
|
if d in day_of_week:
|
|
|
@@ -913,7 +918,7 @@ class HTMLReportCreator(ReportCreator):
|
|
913
|
918
|
|
|
914
|
919
|
|
|
915
|
920
|
# Hour of Week
|
|
916
|
|
- writeHeaderstoNewTSV( path+"/hour_of_week_TEST.tsv", ['day','hour','value'])
|
|
|
921
|
+ writeHeaderstoNewFile( path+"/hour_of_week_TEST.tsv", ['day','hour','value'], "\t")
|
|
917
|
922
|
hour_of_week_TEST=open( path+"/hour_of_week_TEST.tsv", "a+")
|
|
918
|
923
|
|
|
919
|
924
|
f.write(html_header(2, 'Hour of Week'))
|
|
|
@@ -959,10 +964,16 @@ class HTMLReportCreator(ReportCreator):
|
|
959
|
964
|
f.write('<img src="month_of_year.png" alt="Month of Year">')
|
|
960
|
965
|
|
|
961
|
966
|
# Commits by year/month
|
|
|
967
|
+ # TEST THIS
|
|
|
968
|
+ writeHeaderstoNewFile(path+"/commits_by_year_month_TABLE.csv", ['Month','Commits','Lines added','Lines removed'], ",")
|
|
|
969
|
+ commits_by_year_month_TABLE=open( path+"/commits_by_year_month_TABLE.csv", "a+")
|
|
|
970
|
+
|
|
|
971
|
+
|
|
962
|
972
|
f.write(html_header(2, 'Commits by year/month'))
|
|
963
|
973
|
f.write('<div class="vtable"><table><tr><th>Month</th><th>Commits</th><th>Lines added</th><th>Lines removed</th></tr>')
|
|
964
|
974
|
for yymm in reversed(sorted(data.commits_by_month.keys())):
|
|
965
|
975
|
f.write('<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td></tr>' % (yymm, data.commits_by_month.get(yymm,0), data.lines_added_by_month.get(yymm,0), data.lines_removed_by_month.get(yymm,0)))
|
|
|
976
|
+ commits_by_year_month_TABLE.write('%s,%d,%d,%d\n' % (yymm, data.commits_by_month.get(yymm,0), data.lines_added_by_month.get(yymm,0), data.lines_removed_by_month.get(yymm,0)))
|
|
966
|
977
|
f.write('</table></div>')
|
|
967
|
978
|
f.write('<img src="commits_by_year_month.png" alt="Commits by year/month">')
|
|
968
|
979
|
fg = open(path + '/commits_by_year_month.dat', 'w')
|