Commit 1641e766719cacb11413ec01e80a918139287d85
1 parent
ebc0db3d
Exists in
master
and in
3 other branches
finished presenting the variables that are being getting, still has issues on cl…
…eaning data from form, specially dates but other stuff are working fine
Showing
2 changed files
with
24 additions
and
15 deletions
Show diff stats
reports/templates/reports/view.html
... | ... | @@ -60,22 +60,24 @@ |
60 | 60 | |
61 | 61 | </ul> |
62 | 62 | <div class="table-responsive"> |
63 | - <table class="table table-stripped"> | |
63 | + <table class="table table-striped"> | |
64 | 64 | <thead> |
65 | 65 | <tr> |
66 | - {% for key in data.keys %} | |
67 | - <th>{{key}}</th> | |
66 | + | |
67 | + {% for value in header %} | |
68 | + <th>{{value}}</th> | |
68 | 69 | {% endfor %} |
69 | 70 | </tr> |
70 | 71 | </thead> |
71 | 72 | <tbody> |
73 | + | |
72 | 74 | |
73 | - {% for value_dict in data.values %} | |
74 | - <tr> | |
75 | - {% for key, value in value_dict.items %} | |
76 | - <td>{{value}}</td> | |
75 | + {% for variables in data.values %} | |
76 | + <tr> | |
77 | + {% for variable in variables %} | |
78 | + <td>{{variable}}</td> | |
77 | 79 | {% endfor %} |
78 | - </tr> | |
80 | + </tr> | |
79 | 81 | {% endfor %} |
80 | 82 | </tbody> |
81 | 83 | ... | ... |
reports/views.py
... | ... | @@ -77,9 +77,8 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
77 | 77 | context['topic_name'] = params_data['topic'] |
78 | 78 | context['init_date'] = params_data['init_date'] |
79 | 79 | context['end_date'] = params_data['end_date'] |
80 | - | |
81 | 80 | if params_data['from_mural']: |
82 | - context['data'] = self.get_mural_data(subject, params_data['init_date'], params_data['end_date']) | |
81 | + context['data'], context['header'] = self.get_mural_data(subject, params_data['init_date'], params_data['end_date']) | |
83 | 82 | return context |
84 | 83 | |
85 | 84 | def get_mural_data(self, subject, init_date, end_date): |
... | ... | @@ -93,10 +92,15 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
93 | 92 | except ValueError: |
94 | 93 | pass |
95 | 94 | |
95 | + header = ['social_name'] | |
96 | 96 | |
97 | 97 | for student in students: |
98 | + data[student] = [] | |
99 | + | |
100 | + data[student].append(student.social_name) | |
101 | + | |
98 | 102 | interactions = {} |
99 | - interactions['username'] = student.social_name | |
103 | + #interactions['username'] = student.social_name | |
100 | 104 | |
101 | 105 | help_posts_made_by_user = SubjectPost.objects.filter(action="help",space__id=subject.id, user=student, |
102 | 106 | create_date__range=(init_date, end_date)) |
... | ... | @@ -164,8 +168,11 @@ class ViewReportView(LoginRequiredMixin, generic.TemplateView): |
164 | 168 | for day_num in day_numbers: |
165 | 169 | interactions['access_subject_'+day_names[day_num]] = Log.objects.filter(action="access", resource="subject", |
166 | 170 | user_id= student.id, context__contains = {'subject_id' : subject.id}, datetime__week_day = day_num).count() |
167 | - | |
168 | - data[student] = interactions | |
169 | - print(data) | |
170 | - return data | |
171 | + | |
172 | + for value in interactions.values(): | |
173 | + data[student].append(value) | |
174 | + if len(header) <= 1: | |
175 | + for key in interactions.keys(): | |
176 | + header.append(key) | |
177 | + return data, header | |
171 | 178 | ... | ... |