Skip to content

Commit

Permalink
Removing some lava flow
Browse files Browse the repository at this point in the history
- Removed two unused files
- Applied some code style to a few files. This should decrease the number of changed LoC
  • Loading branch information
DominikRemo committed Oct 26, 2024
1 parent c7361a3 commit b4e2561
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 107 deletions.
Empty file.
26 changes: 13 additions & 13 deletions playground/src/helpers/get_data.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type {Exercise} from "@/model/exercise";
import type {Submission} from "@/model/submission";
import type {CategorizedFeedback, Feedback} from "@/model/feedback";
import type {DataMode} from "@/model/data_mode";
import type { Exercise } from "@/model/exercise";
import type { Submission } from "@/model/submission";
import type { CategorizedFeedback, Feedback } from "@/model/feedback";
import type { DataMode } from "@/model/data_mode";

import path from "path";
import fs from "fs";

import baseUrl from "@/helpers/base_url";
import {Metric} from "@/model/metric";
import {ExpertEvaluationProgress} from "@/model/expert_evaluation_progress";
import {ExpertEvaluationConfig} from "@/model/expert_evaluation_config";
import {v4 as uuidv4} from "uuid";
import { Metric } from "@/model/metric";
import { ExpertEvaluationProgress } from "@/model/expert_evaluation_progress";
import { ExpertEvaluationConfig } from "@/model/expert_evaluation_config";
import { v4 as uuidv4 } from "uuid";

/**
* Splits the given data mode into its parts.
Expand Down Expand Up @@ -267,7 +267,7 @@ export function addStructuredGradingInstructionsToFeedback(
}
});
submission.feedbacks = processedFeedbacks;
}
}
}
}
}
Expand Down Expand Up @@ -301,7 +301,7 @@ function jsonToFeedbacks(json: any): Feedback[] {
});
}

function jsonToMetrics(json: any): Metric [] {
function jsonToMetrics(json: any): Metric[] {
return json.metrics;
}

Expand Down Expand Up @@ -389,7 +389,7 @@ export function anonymizeFeedbackCategoriesAndShuffle(
// Iterate over each feedback category and anonymize the category names
Object.keys(feedback).forEach((originalCategory) => {
const anonymizedCategory = uuidv4();
mappings[anonymizedCategory] = originalCategory;
mappings[anonymizedCategory] = originalCategory;

anonymizedFeedback[anonymizedCategory] = feedback[originalCategory];
});
Expand Down Expand Up @@ -434,7 +434,7 @@ export function saveConfigToFileSync(

// Create parent directory
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, {recursive: true});
fs.mkdirSync(dirPath, { recursive: true });
}

if (expertEvaluation.expertIds) {
Expand Down Expand Up @@ -519,7 +519,7 @@ export function getAnonymizedConfigFromFileSync(

export function getAllConfigsFromFilesSync(
dataMode: DataMode,
): ExpertEvaluationConfig [] {
): ExpertEvaluationConfig[] {

const configPath = path.join(
process.cwd(),
Expand Down
8 changes: 4 additions & 4 deletions playground/src/hooks/playground/exercises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export async function fetchExercisesEager(dataMode: DataMode) {
}

export async function fetchExpertEvaluationExercisesEager(
dataMode: DataMode,
expertEvaluationId: string
) {
dataMode: DataMode,
expertEvaluationId: string
) {

const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${expertEvaluationId}/exercises`);
return await response.json() as Promise<Exercise[]>;
Expand Down Expand Up @@ -49,4 +49,4 @@ export default function useExercises(
},
...options
});
}
}
2 changes: 1 addition & 1 deletion playground/src/hooks/playground/expert_evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export default function useDownloadExpertEvaluationData(
},
...options,
});
}
}
8 changes: 4 additions & 4 deletions playground/src/hooks/playground/expert_evaluation_config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useMutation, UseMutationOptions} from "react-query";
import { useMutation, UseMutationOptions } from "react-query";
import baseUrl from "@/helpers/base_url";
import {ExpertEvaluationConfig} from "@/model/expert_evaluation_config";
import {DataMode} from "@/model/data_mode";
import { ExpertEvaluationConfig } from "@/model/expert_evaluation_config";
import { DataMode } from "@/model/data_mode";

/** Saves a new or existing expert evaluation config to the server */
export async function saveExpertEvaluationConfig(
Expand All @@ -10,7 +10,7 @@ export async function saveExpertEvaluationConfig(

const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${config.id}/config`, {
method: 'POST',
headers: {"Content-Type": "application/json"},
headers: { "Content-Type": "application/json" },
body: JSON.stringify(config),
});

Expand Down
22 changes: 11 additions & 11 deletions playground/src/hooks/playground/expert_evaluation_progress.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {DataMode} from "@/model/data_mode";
import { DataMode } from "@/model/data_mode";
import baseUrl from "@/helpers/base_url";
import {ExpertEvaluationProgress} from "@/model/expert_evaluation_progress";
import { ExpertEvaluationProgress } from "@/model/expert_evaluation_progress";

export async function saveExpertEvaluationProgress(
dataMode: DataMode,
expertEvaluationId: string,
expertId: string,
progress: ExpertEvaluationProgress) {
dataMode: DataMode,
expertEvaluationId: string,
expertId: string,
progress: ExpertEvaluationProgress) {
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${expertEvaluationId}/${expertId}/progress`, {
method: 'POST',
headers: {
Expand All @@ -19,11 +19,11 @@ export async function saveExpertEvaluationProgress(
}

export async function fetchExpertEvaluationProgress(
dataMode: DataMode,
expertEvaluationId: string,
expertId: string,
dataMode: DataMode,
expertEvaluationId: string,
expertId: string,
) {
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${expertEvaluationId}/${expertId}/progress`);
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${expertEvaluationId}/${expertId}/progress`);

return await response.json() as Promise<ExpertEvaluationProgress>;
return await response.json() as Promise<ExpertEvaluationProgress>;
}
16 changes: 8 additions & 8 deletions playground/src/hooks/playground/feedbacks.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {CategorizedFeedback, Feedback} from "@/model/feedback";
import type {Submission} from "@/model/submission";
import type {Exercise} from "@/model/exercise";
import type {DataMode} from "@/model/data_mode";
import type { Feedback } from "@/model/feedback";
import type { Submission } from "@/model/submission";
import type { Exercise } from "@/model/exercise";
import type { DataMode } from "@/model/data_mode";

import {useQuery, UseQueryOptions} from "react-query";
import { useQuery, UseQueryOptions } from "react-query";
import baseUrl from "@/helpers/base_url";
import {useBaseInfo} from "@/hooks/base_info_context";
import { useBaseInfo } from "@/hooks/base_info_context";

export async function fetchFeedbacks(
exercise: Exercise | undefined,
Expand Down Expand Up @@ -44,7 +44,7 @@ export default function useFeedbacks(
submission?: Submission,
options: Omit<UseQueryOptions<Feedback[], Error, Feedback[]>, 'queryFn'> = {}
) {
const {dataMode} = useBaseInfo();
const { dataMode } = useBaseInfo();

return useQuery({
queryKey: ["feedbacks", dataMode, exercise?.id, submission?.id],
Expand All @@ -53,4 +53,4 @@ export default function useFeedbacks(
},
...options
});
}
}
12 changes: 6 additions & 6 deletions playground/src/hooks/playground/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {DataMode} from "@/model/data_mode";
import { DataMode } from "@/model/data_mode";
import baseUrl from "@/helpers/base_url";
import {Metric} from "@/model/metric";
import { Metric } from "@/model/metric";

export async function fetchMetrics(
dataMode: DataMode,
expertEvaluationId: string
) {
dataMode: DataMode,
expertEvaluationId: string
) {
const response = await fetch(`${baseUrl}/api/data/${dataMode}/expert_evaluation/${expertEvaluationId}/metrics`);

return await response.json() as Promise<Metric[]>;
}
}

This file was deleted.

0 comments on commit b4e2561

Please sign in to comment.