Added quiz card on profile page
diff --git a/erpnext/public/js/education/lms/components/ScoreCard.vue b/erpnext/public/js/education/lms/components/ScoreCard.vue
index 523f4ac..5a6aee5 100644
--- a/erpnext/public/js/education/lms/components/ScoreCard.vue
+++ b/erpnext/public/js/education/lms/components/ScoreCard.vue
@@ -2,22 +2,58 @@
<div class='card-deck mt-3'>
<div class="card">
<div class='card-body'>
- <div class="course-details">
- <h5 class='card-title'>ECP2018 > Introduction Quiz</h5>
- <span class="course-list text-muted" id="getting-started">
- Courses
- </span>
+ <div class="row">
+ <div class="course-details col-xs-7 col-sm-8 col-md-9">
+ <div class="course-details">
+ <h5 class='card-title'>{{ quizData.program }}</h5>
+ <div v-for="attempt in quizData.quiz_attempt" :key="attempt.content" class="course-list" id="getting-started">
+ <div><b>{{ attempt.content }}</b>
+ <span v-if="attempt.is_complete">- {{ attempt.score }} - {{attempt.result }}</span>
+ <span v-else>- Unattempted</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class='course-buttons text-center col-xs-5 col-sm-4 col-md-3'>
+ <a-button
+ :type="'primary'"
+ size="sm btn-block"
+ :route="programRoute"
+ >
+ Go To Program
+ </a-button>
+ </div>
</div>
</div>
</div>
</div>
</template>
<script>
+import AButton from './Button.vue';
export default {
props: ['program'],
name: "ScoreCard",
data() {
- }
+ return {
+ quizData: {}
+ };
+ },
+ mounted() {
+ this.getQuizProgress().then(data => this.quizData = data)
+ },
+ methods: {
+ getQuizProgress() {
+ return lms.call('get_quiz_progress', {
+ program_name: this.program
+ })
+ },
+ programRoute() {
+ return {name: 'program', params: {program_name: this.program}}
+ },
+ },
+ components: {
+ AButton
+ },
};
</script>
diff --git a/erpnext/public/js/education/lms/pages/ProfilePage.vue b/erpnext/public/js/education/lms/pages/ProfilePage.vue
index 0177df8..f7399b9 100644
--- a/erpnext/public/js/education/lms/pages/ProfilePage.vue
+++ b/erpnext/public/js/education/lms/pages/ProfilePage.vue
@@ -5,7 +5,7 @@
<ProgressCard slot="card-list-slot" v-for="program in enrolledPrograms" :program="program" :key="program"/>
</CardList>
<CardList :title="'Quiz Attempts'" :description="''" :sectionType="'section-padding section'">
- <ScoreCard slot="card-list-slot"/>
+ <ScoreCard slot="card-list-slot" v-for="program in enrolledPrograms" :program="program" :key="program"/>
</CardList>
</div>
diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py
index 822c130..c0cc6fa 100644
--- a/erpnext/www/lms.py
+++ b/erpnext/www/lms.py
@@ -259,8 +259,9 @@
course_enrollment = utils.get_course_enrollment(course.course)
meta = get_course_progress(course_enrollment)
for progress_item in meta:
+ # if progress_item['content_type'] == "Quiz" and progress_item['is_complete'] == True:
if progress_item['content_type'] == "Quiz":
- progress_item['course'] = course.course
+ progress_item['course'] = course.course_name
progress_list.append(progress_item)
quiz_meta.quiz_attempt = progress_list
quiz_meta.name = program_name