Commit 98b41267 authored by Tim Honcoop's avatar Tim Honcoop
Browse files

Changed video list slightly

parent 10410f3b
Pipeline #2530 failed with stages
in 1 minute and 7 seconds
......@@ -249,7 +249,7 @@ export default {
TopbarNav,
BackButton,
MultiSelect,
Datepicker
Datepicker,
},
data() {
return {
......@@ -275,7 +275,7 @@ export default {
action: {
date: null,
title: "",
description: ""
description: "",
},
actionToDelete: {},
......@@ -293,24 +293,24 @@ export default {
filterOptions: [
{
text: "No filter",
id: "no_filter"
id: "no_filter",
},
{
text: "Has paid only",
id: "has_paid"
}
id: "has_paid",
},
],
cohorts: [{ name: "Cohorts not yet implemented", id: "no_cohort" }],
cohorts: [{ name: "Cohorts not yet implemented", id: "no_cohort", },],
selectedCohort: "no_cohort",
countries: [{ name: "Netherlands", id: 1 }, { name: "Germany", id: 2 }],
countries: [{ name: "Netherlands", id: 1, }, { name: "Germany", id: 2, },],
selectedCountries: [],
selectedCourse: settings.course_default,
selectedSubitem: "",
// Mock
courses: {
coursera: []
}
coursera: [],
},
};
},
beforeMount() {
......@@ -324,7 +324,7 @@ export default {
this.courses.coursera.push({
name: course.course_name,
description: "",
slug: course.course_slug
slug: course.course_slug,
});
}
util
......@@ -339,7 +339,7 @@ export default {
},
mounted() {
this.platformOptions = [
{ value: settings.platform_default, text: strings.select_platform }
{ value: settings.platform_default, text: strings.select_platform, },
];
this.setPlatforms();
......@@ -361,14 +361,14 @@ export default {
path += subroute + "/";
routes.push({
text: subroute.charAt(0).toUpperCase() + subroute.slice(1),
to: path.substring(0, path.length - 1)
to: path.substring(0, path.length - 1),
});
}
}
routes[0].text = strings.home;
routes[0].to = "/";
return routes;
}
},
},
methods: {
saveAction() {
......@@ -400,7 +400,7 @@ export default {
this.action = {
date: null,
title: "",
description: ""
description: "",
};
this.showAddActionModal = false;
this.showActionsModal = true;
......@@ -585,8 +585,8 @@ export default {
this.courseOptions = [
{
value: settings.course_default,
text: strings.select_course
}
text: strings.select_course,
},
];
},
setPlatforms() {
......@@ -594,7 +594,7 @@ export default {
this.top_nav[0].push({
name: strings.home,
icon: "cui-home",
url: "/home"
url: "/home",
});
for (var platform of this.platforms) {
this.top_nav[0].push({
......@@ -612,15 +612,15 @@ export default {
this.courseOptions = [
{
value: settings.course_default,
text: strings.select_course
}
text: strings.select_course,
},
];
this.top_nav[1] = [];
for (var course of c) {
// Push to dropdown
this.courseOptions.push({
value: course.slug,
text: course.name
text: course.name,
});
// Push to navbar
this.top_nav[1].push({
......@@ -642,7 +642,7 @@ export default {
"/" +
this.selectedCourse +
"/" +
coursepPage.slug
coursepPage.slug,
});
}
},
......@@ -662,7 +662,7 @@ export default {
this.selectedCourse +
"/videos/" +
video.item_id,
icon: "fa fa-video-camera"
icon: "fa fa-video-camera",
});
this.$forceUpdate();
}
......@@ -689,7 +689,7 @@ export default {
quiz.base_id +
"-" +
quiz.version,
icon: "fa fa-check "
icon: "fa fa-check ",
});
this.$forceUpdate();
}
......@@ -717,7 +717,7 @@ export default {
this.selectedCourse +
"/assignments/" +
assignment.item_id,
icon: "cui-calendar "
icon: "cui-calendar ",
});
this.$forceUpdate();
}
......@@ -726,8 +726,8 @@ export default {
this.top_nav[3] = [];
console.log(err);
});
}
}
},
},
};
</script>
......
......@@ -23,7 +23,8 @@
:to="link + '/' + video.item_id"
>{{ video.name }}</router-link>
<div
v-if="warnings && ( (video.video_dislikes / video.video_likes) < dislike_warning)"
v-if="warnings && (video.finsihed_watcher_ratio < finished_warning
|| video.like_dislike_ratio < dislike_warning)"
class="warning-container"
>
<i
......@@ -41,11 +42,13 @@
<li v-if="!video.optional">
<span class="li-title">Optional:</span> no
</li>
</ul>
<ul>
<li>
<span class="li-title">Completed/watched ratio:</span>
{{Math.round(100*video.finished_video/video.watched_video)/100 }}
{{ video.finsihed_watcher_ratio }}
</li>
<li>
<span class="li-title">Like/dislike ratio:</span>
{{ video.like_dislike_ratio }}
</li>
</ul>
</b-card-body>
......@@ -62,8 +65,8 @@
:to="link + '/' + video.item_id"
>{{ video.name }}</router-link>
<div
v-if="video.likes > 0 && warnings && ((video.finished_video / video.watched_video) < finished_warning
|| (video.dislikes / video.likes) < dislike_warning)"
v-if="warnings && (video.finsihed_watcher_ratio < finished_warning
|| video.like_dislike_ratio < dislike_warning)"
class="warning-container"
>
<i
......@@ -81,9 +84,13 @@
<li v-if="!video.optional">
<span class="li-title">Optional:</span> no
</li>
<li v-if="video.finished_video / video.watched_video < finished_warning">
<span class="li-title">Low Completed rate:&nbsp;</span>
<span>{{Math.round((video.finished_video / video.watched_video)*100)}}%</span>
<li>
<span class="li-title">Finished watchers ratio:&nbsp;</span>
<span>{{ video.finsihed_watcher_ratio }}</span>
</li>
<li>
<span class="li-title">Like/dislike ratio:&nbsp;</span>
<span>{{ video.like_dislike_ratio }}</span>
</li>
</ul>
</b-card-body>
......@@ -98,7 +105,7 @@
</template>
<script>
//import settings from "@/settings";
import settings from "@/settings";
import util from "@/util";
import strings from "@/strings";
import colors from "@/colors";
......@@ -112,6 +119,7 @@ export default {
// Color scheme, change this color
// to change the page's primary color.
mainColor: colors.course,
settings: settings,
courseId: "",
loadingText: strings.loading,
......@@ -157,6 +165,7 @@ export default {
this.isLoading = false;
this.lessons = util.convertToLessons(response.data);
this.videos = response.data;
this.parseVideos();
} else {
this.loadingText = strings.no_videos;
}
......@@ -167,6 +176,25 @@ export default {
});
}
},
parseVideos() {
for (let video of this.videos) {
if (video.dislikes !== 0 || video.likes !== 0) {
video.like_dislike_ratio = parseFloat(
video.video_likes / (video.video_likes + video.video_dislikes)
).toFixed(2);
} else {
video.like_dislike_ratio = 0;
}
if (video.finished_video !== 0 || video.watched_video !== 0) {
video.finsihed_watcher_ratio = parseFloat(
video.finished_video / video.watched_video
).toFixed(2);
} else {
video.finsihed_watcher_ratio = 0;
}
}
},
},
};
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment