Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Exercises for offline Usage #118

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion shared/models/testcase.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export enum TestCaseType {
}

export class TestCase {
id?: number;
id: number;
testName?: string;
weight?: number;
bonusMultiplier?: number;
Expand All @@ -17,4 +17,26 @@ export class TestCase {
visibility?: Visibility;
exercise?: ProgrammingExercise;
type?: TestCaseType;

constructor(
id: number,
testName?: string,
weight?: number,
bonusMultiplier?: number,
bonusPoints?: number,
active?: boolean,
visibility?: Visibility,
exercise?: ProgrammingExercise,
type?: TestCaseType
){
this.id = id;
this.testName = testName;
this.weight = weight;
this.bonusMultiplier = bonusMultiplier;
this.bonusPoints = bonusPoints;
this.active = active;
this.visibility = visibility;
this.exercise = exercise;
this.type = type;
}
}
6 changes: 6 additions & 0 deletions src/course/repository/course.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Course } from "@shared/models/course.model";

export interface CourseDB {
getCourse(courseId: string): Promise<Course>;
saveCourse(course: Course): Promise<Course>;
}
12 changes: 12 additions & 0 deletions src/course/repository/course.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Course } from "@shared/models/course.model";
import { CourseDB } from "./course.interface.repo";

class CourseDBKeyValue implements CourseDB {
getCourse(courseId: string): Promise<Course> {
throw new Error("Method not implemented.");
}

saveCourse(course: Course): Promise<Course> {
throw new Error("Method not implemented.");
}
}
2 changes: 1 addition & 1 deletion src/exercise/exercise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
start_exercise,
} from "../participation/participation.api";
import { StudentParticipation } from "@shared/models/participation.model";
import { cloneRepository } from "../shared/repository";
import { cloneRepository } from "../shared/gitRepo";
import { NotAuthenticatedError } from "../authentication/not_authenticated.error";
import { Result } from "@shared/models/result.model";
import { fetch_course_exercise_projectKey } from "./exercise.api";
Expand Down
7 changes: 7 additions & 0 deletions src/exercise/repository/exercise.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Course } from "@shared/models/course.model";
import { Exercise } from "@shared/models/exercise.model";

export interface ExerciseDB {
getExercise(exerciseId: string): Promise<Exercise>;
saveExercise(exercise: Exercise): Promise<Exercise>;
}
12 changes: 12 additions & 0 deletions src/exercise/repository/exercise.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ExerciseDB } from "./exercise.interface.repo";
import { Exercise } from "@shared/models/exercise.model";

class ExerciseDBKeyValue implements ExerciseDB {
getExercise(exerciseId: string): Promise<Exercise> {
throw new Error("Method not implemented.");
}

saveExercise(exercise: Exercise): Promise<Exercise> {
throw new Error("Method not implemented.");
}
}
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { build_exercise_options, cloneCurrentExercise } from "./exercise/exercis
import { SidebarProvider } from "./sidebar/sidebarProvider";
import { ArtemisAuthenticationProvider, AUTH_ID } from "./authentication/authentication_provider";
import { set_state, state } from "./shared/state";
import { detectRepoCourseAndExercise, submitCurrentWorkspace } from "./shared/repository";
import { detectRepoCourseAndExercise, submitCurrentWorkspace } from "./shared/gitRepo";
import { sync_problem_statement_with_workspace } from "./problemStatement/problem_statement";
import { NotAuthenticatedError } from "./authentication/not_authenticated.error";
import { initTheia, theiaEnv } from "./theia/theia";
Expand Down
6 changes: 6 additions & 0 deletions src/feedback/repository/feedback.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Feedback } from "@shared/models/feedback.model";

export interface FeedbackDB {
getFeedback(feedbackId: string): Promise<Feedback>;
saveFeedback(feedback: Feedback): Promise<Feedback>;
}
12 changes: 12 additions & 0 deletions src/feedback/repository/feedback.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Feedback } from "@shared/models/feedback.model";
import { FeedbackDB } from "./feedback.interface.repo";

class FeedbackDBKeyValue implements FeedbackDB {
getFeedback(feedbackId: string): Promise<Feedback> {
throw new Error("Method not implemented.");
}

saveFeedback(feedback: Feedback): Promise<Feedback> {
throw new Error("Method not implemented.");
}
}
6 changes: 6 additions & 0 deletions src/participation/repository/participation.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { StudentParticipation } from "@shared/models/participation.model";

export interface ParticipationDB {
getParticipation(participationId: string): Promise<StudentParticipation>;
saveParticipation(participation: StudentParticipation): Promise<StudentParticipation>;
}
12 changes: 12 additions & 0 deletions src/participation/repository/participation.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { StudentParticipation } from "@shared/models/participation.model";
import { ParticipationDB } from "./participation.interface.repo";

class ParticipationDBKeyValue implements ParticipationDB {
getParticipation(participationId: string): Promise<StudentParticipation> {
throw new Error("Method not implemented.");
}

saveParticipation(participation: StudentParticipation): Promise<StudentParticipation> {
throw new Error("Method not implemented.");
}
}
6 changes: 6 additions & 0 deletions src/result/repository/result.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Result } from "@shared/models/result.model";

export interface ResultDB {
getResult(resultId: string): Promise<Result>;
saveResult(result: Result): Promise<Result>;
}
12 changes: 12 additions & 0 deletions src/result/repository/result.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Result } from "@shared/models/result.model";
import { ResultDB } from "./result.interface.repo";

class ResultDBKeyValue implements ResultDB {
getResult(resultId: string): Promise<Result> {
throw new Error("Method not implemented.");
}

saveResult(result: Result): Promise<Result> {
throw new Error("Method not implemented.");
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions src/testcase/repository/testcase.interface.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { TestCase } from "@shared/models/testcase.model";

export interface TestCaseDB {
getTestCase(testCaseId: string): Promise<TestCase>;
saveTestCase(testCase: TestCase): Promise<TestCase>;
}
12 changes: 12 additions & 0 deletions src/testcase/repository/testcase.repo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { TestCase } from "@shared/models/testcase.model";
import { TestCaseDB } from "./testcase.interface.repo";

class TestCaseDBKeyValue implements TestCaseDB {
getTestCase(testCaseId: string): Promise<TestCase> {
throw new Error("Method not implemented.");
}

saveTestCase(testCase: TestCase): Promise<TestCase> {
throw new Error("Method not implemented.");
}
}
Loading