Skip to content

Commit

Permalink
Merge pull request #12 from HumanDynamics/internal_report
Browse files Browse the repository at this point in the history
updated Internal report
  • Loading branch information
OrenLederman committed Jun 23, 2016
2 parents 690f274 + 1622648 commit 5b1a172
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/openbadge/newGraph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from matplotlib import pyplot, dates, rcParams
from django.conf import settings

import os
import os, csv

def groupStatGraph(durations, num_meetings, days, names, graph_path):

Expand Down Expand Up @@ -44,8 +44,11 @@ def groupStatGraph(durations, num_meetings, days, names, graph_path):

agg_graph_file = aggregateGraph(agg_duration, agg_num_meetings, days, graph_path)

csv_file = generateTable(durations, days, names, graph_path)

return {'group_img':'team_meeting_summary_graph.png', 'agg_img':agg_graph_file,
'time':{'hrs':int(total_time), 'mins': int((total_time-int(total_time))*60)}, 'num_meetings':sum(agg_num_meetings)}
'time':{'hrs':int(total_time), 'mins': int((total_time-int(total_time))*60)},
'num_meetings':sum(agg_num_meetings), 'stats_csv':csv_file}

def aggregateGraph(durations, num_meetings, days, graph_path):

Expand All @@ -67,4 +70,20 @@ def aggregateGraph(durations, num_meetings, days, graph_path):
pyplot.close()

return 'aggregate_summary_graph.png'

def generateTable(durations, days, names, table_path):

headers = days
headers.insert(0, 'Group\Date')

csv_data = durations

for i in xrange(len(names)):
csv_data[i].insert(0, names[i])

csv_data.insert(0, headers)

table_stats = csv.writer(open(table_path + '/group_stats.csv', 'wb'))
table_stats.writerows(csv_data)

return 'group_stats.csv'
2 changes: 1 addition & 1 deletion src/openbadge/templates/reports/internal_report.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h3>Aggregate Meetings And Duration For Each Day</h3>
<img src="/media/tmp/{{metadata.agg_img}}" / alt="graph" height="400">
</div>
<div class="chart-notes">
<h5>Bar graph denotes number of meetings and line denotes duration</h5>
<h4><a href="/media/tmp/{{metadata.stats_csv}}" />Link to CSV file for group statistics</a></h4>
</div>
</div>
</div>
Expand Down

0 comments on commit 5b1a172

Please sign in to comment.