Commit 3257d212 authored by Brouwers, A.S.'s avatar Brouwers, A.S.
Browse files

Fix cohort ids

parent 1e1f48a7
Pipeline #2524 passed with stages
in 2 minutes and 59 seconds
......@@ -304,7 +304,7 @@ export default {
TopbarNav,
BackButton,
MultiSelect,
Datepicker
Datepicker,
},
data() {
return {
......@@ -312,7 +312,7 @@ export default {
isPrimary: false,
level: 0,
top_nav: [],
level_0: ["/home", "/settings", "/contact"],
level_0: ["/home", "/settings", "/contact",],
platforms: settings.platforms,
bottom_nav: nav.bottom_items,
testCount: 5,
......@@ -331,7 +331,7 @@ export default {
action: {
date: null,
title: "",
description: ""
description: "",
},
actionToDelete: {},
......@@ -351,7 +351,7 @@ export default {
},
cohort: {
name: null,
id: null,
number: null,
show: false,
},
},
......@@ -364,7 +364,7 @@ export default {
date: null,
},
cohort: {
id: null,
number: null,
},
},
......@@ -376,25 +376,25 @@ export default {
filterOptions: [
{
text: "No filter",
id: "no_filter"
id: "no_filter",
},
{
text: "Has paid only",
id: "has_paid"
}
id: "has_paid",
},
],
cohorts: [{ text: "test1", value: "1", }, { text: "test2", value: "2", },],
cohortList: [],
selectedCohort: null,
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() {
......@@ -402,7 +402,7 @@ export default {
this.courses.coursera.push({
name: course.course_name,
description: "",
slug: course.course_slug
slug: course.course_slug,
});
}
util
......@@ -417,7 +417,7 @@ export default {
},
mounted() {
this.platformOptions = [
{ value: settings.platform_default, text: strings.select_platform }
{ value: settings.platform_default, text: strings.select_platform, },
];
this.setPlatforms();
......@@ -440,7 +440,7 @@ 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),
});
}
}
......@@ -480,7 +480,7 @@ export default {
let c = cohorts[i];
this.cohortList.push({
name:
c.id +
c.number +
": " +
new Date(c.from_date).toDateString().substring(4) +
" - " +
......@@ -526,7 +526,7 @@ export default {
this.action = {
date: null,
title: "",
description: ""
description: "",
};
this.showAddActionModal = false;
this.showActionsModal = true;
......@@ -768,8 +768,8 @@ export default {
this.courseOptions = [
{
value: settings.course_default,
text: strings.select_course
}
text: strings.select_course,
},
];
},
setPlatforms() {
......@@ -777,17 +777,17 @@ 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({
name: platform.name,
url: platform.url || "/" + platform.slug,
icon: "fa fa-line-chart"
icon: "fa fa-line-chart",
});
this.platformOptions.push({
value: platform.slug,
text: platform.name
text: platform.name,
});
}
},
......@@ -795,21 +795,21 @@ 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({
name: course.name,
url: "/" + this.selectedPlatform + "/" + course.slug,
icon: "fa fa-line-chart"
icon: "fa fa-line-chart",
});
}
},
......@@ -825,7 +825,7 @@ export default {
"/" +
this.selectedCourse +
"/" +
coursepPage.slug
coursepPage.slug,
});
}
},
......@@ -845,7 +845,7 @@ export default {
this.selectedCourse +
"/videos/" +
video.item_id,
icon: "fa fa-video-camera"
icon: "fa fa-video-camera",
});
this.$forceUpdate();
}
......@@ -872,7 +872,7 @@ export default {
quiz.base_id +
"-" +
quiz.version,
icon: "fa fa-check "
icon: "fa fa-check ",
});
this.$forceUpdate();
}
......@@ -900,7 +900,7 @@ export default {
this.selectedCourse +
"/assignments/" +
assignment.item_id,
icon: "cui-calendar "
icon: "cui-calendar ",
});
this.$forceUpdate();
}
......@@ -909,8 +909,8 @@ export default {
this.top_nav[3] = [];
console.log(err);
});
}
}
},
},
};
</script>
......
......@@ -317,7 +317,12 @@ export default {
},
getCohortName(cohort) {
return (
"Cohort " + cohort.id + ": " + cohort.from_date + " - " + cohort.to_date
"Cohort " +
cohort.number +
": " +
cohort.from_date +
" - " +
cohort.to_date
);
},
getCourseData() {
......@@ -327,7 +332,6 @@ export default {
var currentCourse = this.$store.state.user.courses.find(
x => x.course_slug === this.course.slug
);
console.log("current course:" + currentCourse);
if (currentCourse) {
this.course.id = currentCourse.course_id;
this.course.name = currentCourse.course_name;
......@@ -342,15 +346,16 @@ export default {
this.setCohort1Data();
this.cohorts = [];
for (let i = 0; i < response.data.cohort_list.length; i++) {
if (i + 1 != this.cohort1.id) {
if (response.data.cohort_list[i][2] != this.cohort1.id) {
this.cohorts.push({
id: i + 1,
number: i + 1,
from_date: new Date(response.data.cohort_list[i][0])
.toDateString()
.substring(4),
to_date: new Date(response.data.cohort_list[i][1])
.toDateString()
.substring(4),
id: response.data.cohort_list[i][2],
});
} else {
this.cohort1.start_date = new Date(
......@@ -365,7 +370,7 @@ export default {
.substring(4);
this.cohort1.name =
"Cohort " +
this.cohort1.id +
(i + 1) +
": " +
new Date(response.data.cohort_list[i][0])
.toDateString()
......
......@@ -17,7 +17,7 @@
</b-col>
<!-- Course comparison button -->
<b-col
v-if="showCompare && this.$store.state.filters.cohort > 0"
v-if="showCompare && this.$store.state.filters.cohort"
disabled="this.numberOfCohorts < 2"
sm="12"
md="6"
......@@ -38,7 +38,7 @@
</b-card>
</div>
</b-col>
<b-col v-if="showCompare && !(this.$store.state.filters.cohort > 0)" sm="12" md="6" lg="2">
<b-col v-if="showCompare && !(this.$store.state.filters.cohort)" sm="12" md="6" lg="2">
<div class="link-container">
<router-link :to="courseCompareUrl">
<b-card class="link-card" @click="resetFilters">
......@@ -297,7 +297,7 @@
>
<table>
<tr>
<th id="id-cell">{{ cohort.id }}</th>
<th id="id-cell">{{ cohort.number }}</th>
<th
id="from-cell"
>{{ new Date(cohort.from_date).toDateString().substring(4) }}</th>
......@@ -435,10 +435,13 @@ export default {
methods: {
goCohortCompare: function() {
let cohort2;
if (this.$store.state.filters.cohort == 1) {
cohort2 = 2;
if (
this.$store.state.filters.cohort ==
this.cohorts.find(c => c.number == 1).id
) {
cohort2 = this.cohorts.find(c => c.number == 2).id;
} else {
cohort2 = 1;
cohort2 = this.cohorts.find(c => c.number == 1).id;
}
this.cohortCompareUrl =
this.$route.path +
......@@ -452,9 +455,10 @@ export default {
this.cohorts = [];
for (let i = 0; i < this.cohortData.length; i++) {
this.cohorts.push({
id: i + 1,
number: i + 1,
from_date: this.cohortData[i][0].substring(0, 10),
to_date: this.cohortData[i][1].substring(0, 10),
id: this.cohortData[i][2],
});
}
this.$parent.$emit("cohorts", this.cohorts);
......
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