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

Added latest update time object #61

Merged
merged 2 commits into from
Aug 22, 2023
Merged
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
1 change: 1 addition & 0 deletions hworker/depot/database/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
objects.UserScore: UserScore,
objects.Formula: Formula,
objects.FinalScore: FinalScore,
objects.UpdateTime: UpdateTime,
}
_model_class_to_object: dict[Type[Base] : Type[objects.StoreObject]] = {
value: key for key, value in _object_to_model_class.items()
Expand Down
12 changes: 12 additions & 0 deletions hworker/depot/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,15 @@ def __init__(self, name: str = None, rating: str = None, **kwargs):
super().__init__(**kwargs)
self.name = name
self.rating = rating


class UpdateTime(Base):
__tablename__ = "update_time"

name: Mapped[str] = mapped_column(String)

# noinspection PyTypeChecker
def __init__(self, name: str = None, update_datetime: datetime.datetime = None, **kwargs):
super().__init__(**kwargs)
self.name = name
self.update_datetime = update_datetime
15 changes: 15 additions & 0 deletions hworker/depot/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ def __init__(self, name: str = None, rating: str = None, **kwargs):
self.rating = rating


class UpdateTime(StoreObject):
"""Latest update time for module"""

name: str
_public_fields: set[str] = {"ID", "timestamp"}
_is_versioned: bool = False

def __init__(self, name: str = None, **kwargs):
kwargs["ID"] = f"{name}"
kwargs["USER_ID"] = ""
kwargs["TASK_ID"] = ""
super().__init__(**kwargs)
self.name = name


class Plagiary(StoreObject):
content: list[str] # ID's ?? or list[Homework] or list[Solution]

Expand Down