Nesta Bentum 4 rokov pred
rodič
commit
0fc6b51c38

+ 1 - 1
report-viewer/src/router/index.ts

@@ -18,7 +18,7 @@ const routes: Array<RouteRecordRaw> = [
     component: OverviewView,
   },
   {
-    path: "/comparison",
+    path: "/comparison/:firstId/:secondId",
     name: "ComparisonView",
     component: ComparisonView,
     props: true,

+ 13 - 12
report-viewer/src/store/store.ts

@@ -95,21 +95,22 @@ const store = createStore<State>({
       return Array.from(state.fileIdToDisplayName.keys());
     },
     getComparisonFileName:
-      (state) => (submissionId: string, fileId: string) => {
+      (state) => (submissionId1: string, submissionId2: string) => {
         return state.submissionIdsToComparisonFileName
-          .get(submissionId)
-          ?.get(fileId);
+          .get(submissionId1)
+          ?.get(submissionId2);
       },
-      getComparisonFileForSubmissions: (state, getters) => (submissionId1: string, submissionId2: string) => {
-        const expectedFileName = getters.getComparisonFileName(submissionId1, submissionId2);
-        const index = Object.keys(store.state.files).find(
-          (name) =>
-             name.endsWith(expectedFileName)
+    getComparisonFileForSubmissions:
+      (state, getters) => (submissionId1: string, submissionId2: string) => {
+        const expectedFileName = getters.getComparisonFileName(
+          submissionId1,
+          submissionId2
         );
-        return index != undefined
-          ? store.state.files[index]
-          : undefined
-      }
+        const index = Object.keys(store.state.files).find((name) =>
+          name.endsWith(expectedFileName)
+        );
+        return index != undefined ? store.state.files[index] : undefined;
+      },
   },
   mutations: {
     addAnonymous(state: State, id) {

+ 1 - 2
report-viewer/src/views/ComparisonView.vue

@@ -118,8 +118,7 @@ export default defineComponent({
       );
     }
     if (!comparison) {
-      console.warn("Could not build comparison file");
-      return;
+      throw "Could not build comparison file";
     }
     const filesOfFirst = ref(comparison.filesOfFirstSubmission);
     const filesOfSecond = ref(comparison.filesOfSecondSubmission);