-
Notifications
You must be signed in to change notification settings - Fork 633
/
ReportsLessonReportPage.vue
123 lines (109 loc) · 3.46 KB
/
ReportsLessonReportPage.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
<CoreBase
:immersivePage="false"
:authorized="userIsAuthorized"
authorizedRole="adminOrCoach"
:showSubNav="true"
>
<TopNavbar slot="sub-nav" />
<KPageContainer>
<ReportsLessonHeader />
<CoreTable :emptyMessage="emptyMessage">
<thead slot="thead">
<tr>
<th>{{ coachStrings.$tr('titleLabel') }}</th>
<th>{{ coachStrings.$tr('progressLabel') }}</th>
<th>{{ coachStrings.$tr('avgTimeSpentLabel') }}</th>
</tr>
</thead>
<transition-group slot="tbody" tag="tbody" name="list">
<tr v-for="tableRow in table" :key="tableRow.node_id">
<td>
<KLabeledIcon>
<KBasicContentIcon slot="icon" :kind="tableRow.kind" />
<KRouterLink
v-if="tableRow.kind === 'exercise'"
:text="tableRow.title"
:to="classRoute(
'ReportsLessonExerciseLearnerListPage',
{ exerciseId: tableRow.content_id }
)"
/>
<KRouterLink
v-else
:text="tableRow.title"
:to="classRoute(
'ReportsLessonResourceLearnerListPage',
{ resourceId: tableRow.content_id }
)"
/>
</KLabeledIcon>
</td>
<td>
<StatusSummary
:tally="tableRow.tally"
:verbose="true"
/>
</td>
<td>
<TimeDuration :seconds="tableRow.avgTimeSpent" />
</td>
</tr>
</transition-group>
</CoreTable>
</KPageContainer>
</CoreBase>
</template>
<script>
import { crossComponentTranslator } from 'kolibri.utils.i18n';
import commonCoach from '../common';
import LessonSummaryPage from '../plan/LessonSummaryPage';
import ReportsLessonHeader from './ReportsLessonHeader';
const LessonSummaryPageStrings = crossComponentTranslator(LessonSummaryPage);
export default {
name: 'ReportsLessonReportPage',
components: {
ReportsLessonHeader,
},
mixins: [commonCoach],
computed: {
emptyMessage() {
return LessonSummaryPageStrings.$tr('noResourcesInLesson');
},
/** TODO COACH
actionOptions() {
return [
{ label: this.coachStrings.$tr('editDetailsAction'), value: 'ReportsLessonEditorPage' },
{
label: this.coachStrings.$tr('manageResourcesAction'),
value: 'ReportsLessonManagerPage',
},
];
},
*/
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
recipients() {
return this.getLearnersForGroups(this.lesson.groups);
},
table() {
const contentArray = this.lesson.node_ids.map(node_id => this.contentNodeMap[node_id]);
const sorted = this._.sortBy(contentArray, ['title']);
const mapped = sorted.map(content => {
const tableRow = {
avgTimeSpent: this.getContentAvgTimeSpent(content.content_id, this.recipients),
tally: this.getContentStatusTally(content.content_id, this.recipients),
};
Object.assign(tableRow, content);
return tableRow;
});
return mapped;
},
},
$trs: {
back: 'All lessons',
},
};
</script>
<style lang="scss" scoped></style>