-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/modeling/apollon-image-render
- Loading branch information
Showing
5 changed files
with
42 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
from sqlalchemy import Column, String, Float, JSON, Enum as SqlEnum | ||
|
||
from sqlalchemy.orm import relationship | ||
from athena.database import Base | ||
from athena.schemas import ExerciseType | ||
from .model import Model | ||
from .big_integer_with_autoincrement import BigIntegerWithAutoincrement | ||
|
||
|
||
class DBExercise(Model): | ||
class DBExercise(Model, Base): | ||
__tablename__ = "exercise" | ||
id = Column(BigIntegerWithAutoincrement, primary_key=True, index=True, nullable=False) | ||
lms_url = Column(String, index=True, nullable=False) | ||
title = Column(String, index=True, nullable=False) | ||
type = Column(SqlEnum(ExerciseType), index=True, nullable=False) | ||
max_points = Column(Float, index=True, nullable=False) | ||
bonus_points = Column(Float, index=True, nullable=False) | ||
grading_instructions = Column(String) | ||
problem_statement = Column(String) | ||
grading_criteria = Column(JSON, nullable=True) | ||
meta = Column(JSON, nullable=False) | ||
|
||
# Polymorphism, discriminator attribute | ||
type = Column(SqlEnum(ExerciseType), index=True, nullable=False) | ||
|
||
__mapper_args__ = { | ||
'polymorphic_identity': 'exercise', | ||
'polymorphic_on': 'type' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
from sqlalchemy import Column, String | ||
from athena.schemas.exercise_type import ExerciseType | ||
from sqlalchemy import Column, String, ForeignKey | ||
from sqlalchemy.orm import relationship | ||
|
||
from athena.database import Base | ||
from .db_exercise import DBExercise | ||
|
||
|
||
class DBModelingExercise(DBExercise, Base): | ||
from .big_integer_with_autoincrement import BigIntegerWithAutoincrement | ||
class DBModelingExercise(DBExercise): | ||
__tablename__ = "modeling_exercises" | ||
|
||
example_solution: str = Column(String) # type: ignore | ||
|
||
example_solution = Column(String) # type: ignore | ||
|
||
id = Column(BigIntegerWithAutoincrement, ForeignKey('exercise.id'), primary_key=True) | ||
submissions = relationship("DBModelingSubmission", back_populates="exercise") | ||
feedbacks = relationship("DBModelingFeedback", back_populates="exercise") | ||
|
||
__mapper_args__ = { | ||
'polymorphic_identity': ExerciseType.modeling.value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
from sqlalchemy import Column, String | ||
from athena.schemas.exercise_type import ExerciseType | ||
from sqlalchemy import Column, String, ForeignKey | ||
from sqlalchemy.orm import relationship | ||
|
||
from athena.database import Base | ||
from .db_exercise import DBExercise | ||
from .big_integer_with_autoincrement import BigIntegerWithAutoincrement | ||
|
||
|
||
class DBProgrammingExercise(DBExercise, Base): | ||
class DBProgrammingExercise(DBExercise): | ||
__tablename__ = "programming_exercises" | ||
|
||
id = Column(BigIntegerWithAutoincrement, ForeignKey('exercise.id'), primary_key=True) | ||
programming_language: str = Column(String, nullable=False) # type: ignore | ||
solution_repository_uri: str = Column(String, nullable=False) # type: ignore | ||
template_repository_uri: str = Column(String, nullable=False) # type: ignore | ||
tests_repository_uri: str = Column(String, nullable=False) # type: ignore | ||
|
||
submissions = relationship("DBProgrammingSubmission", back_populates="exercise") | ||
feedbacks = relationship("DBProgrammingFeedback", back_populates="exercise") | ||
|
||
__mapper_args__ = { | ||
'polymorphic_identity': ExerciseType.programming.value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
from sqlalchemy import Column, String | ||
from athena.schemas.exercise_type import ExerciseType | ||
from sqlalchemy import Column, String, ForeignKey | ||
from sqlalchemy.orm import relationship | ||
|
||
from athena.database import Base | ||
from .db_exercise import DBExercise | ||
from .big_integer_with_autoincrement import BigIntegerWithAutoincrement | ||
|
||
|
||
class DBTextExercise(DBExercise, Base): | ||
class DBTextExercise(DBExercise): | ||
__tablename__ = "text_exercises" | ||
id = Column(BigIntegerWithAutoincrement, ForeignKey('exercise.id'), primary_key=True) | ||
|
||
example_solution: str = Column(String) # type: ignore | ||
|
||
submissions = relationship("DBTextSubmission", back_populates="exercise") | ||
feedbacks = relationship("DBTextFeedback", back_populates="exercise") | ||
|
||
__mapper_args__ = { | ||
'polymorphic_identity': ExerciseType.text.value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters