Fix some tests, fix linting
This commit is contained in:
parent
34512f8db0
commit
e0b4a045ce
|
|
@ -85,7 +85,7 @@ function hasActionButton(): boolean {
|
|||
<div class="flex flex-col space-y-8 bg-white p-6">
|
||||
<div class="border-b border-gray-300 pb-8">
|
||||
<div class="flex flex-row items-start justify-between">
|
||||
<h3 class="mb-4 text-3xl">{{ courseName }}</h3>
|
||||
<h3 class="mb-4 text-3xl" data-cy="db-course-title">{{ courseName }}</h3>
|
||||
<a
|
||||
v-if="hasActionButton()"
|
||||
:href="actionButtonProps.href"
|
||||
|
|
|
|||
|
|
@ -2,17 +2,19 @@
|
|||
import type {
|
||||
AssignmentCompletionMetricsType,
|
||||
AssignmentStatisticsRecordType,
|
||||
CourseStatisticsType,
|
||||
StatisticsCircleDataType,
|
||||
} from "@/gql/graphql";
|
||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
||||
import dayjs from "dayjs";
|
||||
import ItProgress from "@/components/ui/ItProgress.vue";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const props = defineProps<{
|
||||
courseSlug: string;
|
||||
courseStatistics: any;
|
||||
courseSessionName: any;
|
||||
circleMeta: any;
|
||||
courseStatistics: CourseStatisticsType;
|
||||
courseSessionName: (sessionId: string) => string;
|
||||
circleMeta: (circleId: string) => StatisticsCircleDataType;
|
||||
}>();
|
||||
|
||||
const assignmentStats = (metrics: AssignmentCompletionMetricsType) => {
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
<script setup lang="ts">
|
||||
import type { PresenceRecordStatisticsType } from "@/gql/graphql";
|
||||
import type {
|
||||
CourseStatisticsType,
|
||||
PresenceRecordStatisticsType,
|
||||
StatisticsCircleDataType,
|
||||
} from "@/gql/graphql";
|
||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||
import ItProgress from "@/components/ui/ItProgress.vue";
|
||||
import { getDateString } from "@/components/dueDates/dueDatesUtils";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const props = defineProps<{
|
||||
courseSlug: string;
|
||||
courseStatistics: any;
|
||||
courseSessionName: any;
|
||||
circleMeta: any;
|
||||
courseStatistics: CourseStatisticsType;
|
||||
courseSessionName: (sessionId: string) => string;
|
||||
circleMeta: (circleId: string) => StatisticsCircleDataType;
|
||||
}>();
|
||||
|
||||
const attendanceStats = (present: number, total: number) => {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import type { CompetenceRecordStatisticsType } from "@/gql/graphql";
|
||||
import type {
|
||||
CompetenceRecordStatisticsType,
|
||||
CourseStatisticsType,
|
||||
StatisticsCircleDataType,
|
||||
} from "@/gql/graphql";
|
||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const props = defineProps<{
|
||||
courseSlug: string;
|
||||
courseStatistics: any;
|
||||
courseSessionName: any;
|
||||
circleMeta: any;
|
||||
courseStatistics: CourseStatisticsType;
|
||||
courseSessionName: (sessionId: string) => string;
|
||||
circleMeta: (circleId: string) => StatisticsCircleDataType;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import type {
|
||||
CourseStatisticsType,
|
||||
FeedbackStatisticsRecordType,
|
||||
PresenceRecordStatisticsType,
|
||||
StatisticsCircleDataType,
|
||||
} from "@/gql/graphql";
|
||||
import StatisticFilterList from "@/components/dashboard/StatisticFilterList.vue";
|
||||
import { getBlendedColorForRating } from "@/utils/ratingToColor";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const props = defineProps<{
|
||||
courseSlug: string;
|
||||
courseStatistics: any;
|
||||
courseSessionName: any;
|
||||
circleMeta: any;
|
||||
courseStatistics: CourseStatisticsType;
|
||||
courseSessionName: (sessionId: string) => string;
|
||||
circleMeta: (circleId: string) => StatisticsCircleDataType;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -387,13 +387,11 @@ router.beforeEach(updateLoggedIn);
|
|||
router.beforeEach(redirectToLoginIfRequired);
|
||||
|
||||
// register after login hooks
|
||||
router.beforeEach(async (to, from) => await handleCurrentCourseSession(to));
|
||||
router.beforeEach(async (to, from) => await handleCourseSessionAsQueryParam(to));
|
||||
router.beforeEach(async (to) => await handleCurrentCourseSession(to));
|
||||
router.beforeEach(async (to) => await handleCourseSessionAsQueryParam(to));
|
||||
|
||||
// only unset the current course session in the after hook
|
||||
router.afterEach(
|
||||
async (to, from) => await handleCurrentCourseSession(to, { unset: true })
|
||||
);
|
||||
router.afterEach(async (to) => await handleCurrentCourseSession(to, { unset: true }));
|
||||
|
||||
router.beforeEach(addToHistory);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ import type {
|
|||
CourseProgressType,
|
||||
CourseStatisticsType,
|
||||
DashboardConfigType,
|
||||
DashboardType,
|
||||
} from "@/gql/graphql";
|
||||
import type { DashboardCourseConfigType } from "@/services/dashboard";
|
||||
import {
|
||||
fetchDashboardConfig,
|
||||
fetchDashboardConfigv2,
|
||||
fetchProgressData,
|
||||
fetchStatisticData,
|
||||
} from "@/services/dashboard";
|
||||
import { defineStore } from "pinia";
|
||||
|
|
@ -27,21 +25,21 @@ export const useDashboardStore = defineStore("dashboard", () => {
|
|||
ref(null);
|
||||
const loading = ref(false);
|
||||
|
||||
const loadDashboardData = async (type: DashboardType, id: string) => {
|
||||
let data;
|
||||
switch (type) {
|
||||
case "STATISTICS_DASHBOARD":
|
||||
data = await fetchStatisticData(id);
|
||||
break;
|
||||
case "PROGRESS_DASHBOARD":
|
||||
data = await fetchProgressData(id);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
dashBoardDataCache[id] = data;
|
||||
currentDashBoardData.value = data;
|
||||
};
|
||||
// const loadDashboardData = async (type: DashboardType, id: string) => {
|
||||
// let data;
|
||||
// switch (type) {
|
||||
// case "STATISTICS_DASHBOARD":
|
||||
// data = await fetchStatisticData(id);
|
||||
// break;
|
||||
// case "PROGRESS_DASHBOARD":
|
||||
// data = await fetchProgressData(id);
|
||||
// break;
|
||||
// default:
|
||||
// return;
|
||||
// }
|
||||
// dashBoardDataCache[id] = data;
|
||||
// currentDashBoardData.value = data;
|
||||
// };
|
||||
|
||||
const switchAndLoadDashboardConfig = async (config: DashboardConfigType) => {
|
||||
currentDashboardConfig.value = config;
|
||||
|
|
@ -85,7 +83,6 @@ export const useDashboardStore = defineStore("dashboard", () => {
|
|||
};
|
||||
|
||||
const loadStatisticsDatav2 = async (id: string) => {
|
||||
console.log("fetching statistics v2 for course ID: ", id);
|
||||
const data = await fetchStatisticData(id);
|
||||
dashBoardDataCache[id] = data;
|
||||
return data;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("attendance");
|
||||
cy.url().should("contain", "/statistic/attendance");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/attendance");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
|
|
@ -70,7 +70,7 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("feedback");
|
||||
cy.url().should("contain", "/statistic/feedback");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/feedback");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
|
|
@ -88,7 +88,7 @@ describe("dashboardSupervisor.cy.js", () => {
|
|||
});
|
||||
it("contains correct details link", () => {
|
||||
clickOnDetailsLink("competence");
|
||||
cy.url().should("contain", "/statistic/competence");
|
||||
cy.url().should("contain", "/statistic/test-lehrgang/competence");
|
||||
|
||||
// might be improved: roughly check
|
||||
// that the correct data is displayed
|
||||
|
|
|
|||
|
|
@ -16,17 +16,19 @@ describe("login.cy.js", () => {
|
|||
cy.get("#username").type("test-student1@example.com");
|
||||
cy.get("#password").type("test");
|
||||
|
||||
cy.get("[data-cy=\"login-button\"]").click();
|
||||
cy.get('[data-cy="login-button"]').click();
|
||||
cy.request("/api/core/me").its("status").should("eq", 200);
|
||||
|
||||
cy.get("[data-cy=\"dashboard-title\"]").should("contain", "Dashboard");
|
||||
cy.get('[data-cy="db-course-title"]')
|
||||
.first()
|
||||
.should("contain", "Test Lehrgang");
|
||||
});
|
||||
|
||||
it("can login with helper function", () => {
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/");
|
||||
cy.request("/api/core/me").its("status").should("eq", 200);
|
||||
cy.get("[data-cy=\"dashboard-title\"]").should("contain", "Dashboard");
|
||||
cy.get('[data-cy="dashboard-title"]').should("contain", "Dashboard");
|
||||
});
|
||||
|
||||
it("login will redirect to requested page", () => {
|
||||
|
|
@ -36,9 +38,9 @@ describe("login.cy.js", () => {
|
|||
cy.get("#username").type("test-student1@example.com");
|
||||
cy.get("#password").type("test");
|
||||
|
||||
cy.get("[data-cy=\"login-button\"]").click();
|
||||
cy.get('[data-cy="login-button"]').click();
|
||||
|
||||
cy.get("[data-cy=\"learning-path-title\"]").should(
|
||||
cy.get('[data-cy="learning-path-title"]').should(
|
||||
"contain",
|
||||
"Test Lehrgang"
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue