diff --git a/frontend/@types/v-clipboard/index.d.ts b/frontend/@types/v-clipboard/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f2dd4459b9daac2e8b5cffd0b18fd0fca3741346 --- /dev/null +++ b/frontend/@types/v-clipboard/index.d.ts @@ -0,0 +1 @@ +declare module 'v-clipboard'; \ No newline at end of file diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 5576736f60685a98f689a1ee5caea62c9a2c278a..ad81436ec767936f2e0d2118a82e08287f7d99f8 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -4,13 +4,13 @@ import router from './router/index' import store from './store/store' import Vuetify from 'vuetify' import Notifications from 'vue-notification' -import Cliboard from 'v-clipboard' +import Clipboard from 'v-clipboard' import 'vuetify/dist/vuetify.min.css' import 'highlight.js/styles/atom-one-light.css' Vue.use(Vuetify) -Vue.use(Cliboard) +Vue.use(Clipboard) Vue.use(Notifications) Vue.config.productionTip = false diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index e780522f3cb6e3a2723bb573f3b59c3304a3e7ec..25b1aeee5b8f2fa7288587de7e8c2e923231c0d9 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,5 +1,5 @@ import Vue from 'vue' -import Router from 'vue-router' +import Router, {RawLocation, Route, NavigationGuard} from 'vue-router' import Login from '@/pages/Login.vue' import StudentSubmissionPage from '@/pages/student/StudentSubmissionPage.vue' import StudentOverviewPage from '@/pages/reviewer/StudentOverviewPage.vue' @@ -19,7 +19,9 @@ import store from '@/store/store' Vue.use(Router) -function denyAccess (next, redirect) { +type rerouteFunc = (to?: RawLocation | false | ((vm: Vue) => any) | void) => void + +function denyAccess (next: rerouteFunc, redirect: Route) { next(redirect.path) VueInstance.$notify({ title: 'Access denied', @@ -28,23 +30,23 @@ function denyAccess (next, redirect) { }) } -function tutorOrReviewerOnly (to, from, next) { +let tutorOrReviewerOnly: NavigationGuard = function (to, from, next) { if (store.getters.isTutorOrReviewer) { next() } else { - denyAccess(next, from.path) + denyAccess(next, from) } } -function reviewerOnly (to, from, next) { +let reviewerOnly: NavigationGuard = function (to, from, next) { if (store.getters.isReviewer) { next() } else { - denyAccess(next, from.path) + denyAccess(next, from) } } -function studentOnly (to, from, next) { +let studentOnly: NavigationGuard = function (to, from, next) { if (store.getters.isStudent) { next() } else { @@ -52,7 +54,7 @@ function studentOnly (to, from, next) { } } -function checkLoggedIn (to, from, next) { +let checkLoggedIn: NavigationGuard = function (to, from, next) { if (store.getters.isLoggedIn) { next() } else { diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js index 5663746c1d79ac91d22c6b369f3455a9e46ed99b..3cdc0cbe2850114a1e33d632a759cd4a2da74a4c 100644 --- a/frontend/src/store/getters.js +++ b/frontend/src/store/getters.js @@ -1,7 +1,7 @@ const getters = { corrected (state) { return state.statistics.submission_type_progress.every(progress => { - return progress.percentage === 100 + return progress.feedback_final === progress.submission_count }) }, getSubmission: state => pk => { diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index c1700466f6d20ad84535501ff813e85d1d5cc680..c19146b1b3e969da65d682034ed2a4d7ab81487e 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "esnext", - "strict": false, + "strict": true, "jsx": "preserve", "importHelpers": true, "moduleResolution": "node", @@ -10,11 +10,6 @@ "esModuleInterop": true, "sourceMap": true, "baseUrl": ".", - "types": [ - "node", - "mocha", - "chai" - ], "paths": { "@/*": [ "src/*" @@ -28,6 +23,7 @@ ] }, "include": [ + "@types/", "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue",