Exemplo n.º 1
0
class Exam:
    """考试"""
    id: str = ""
    name: str = ""
    status: str = ""
    grade_code: str = ""
    subject_codes: ExtendedList[str] = field(default_factory=ExtendedList,
                                             repr=False)
    schools: ExtendedList[School] = field(default_factory=ExtendedList,
                                          repr=False)
    create_school: School = field(default_factory=School, repr=False)
    create_user: Person = field(default_factory=Person, repr=False)
    _create_timestamp: float = field(default=0, repr=False)
    create_time = get_property("_create_timestamp")
    _exam_timestamp: float = field(default=0, repr=False)
    exam_time = get_property("_exam_timestamp")
    _complete_timestamp: float = field(default=0, repr=False)
    complete_time = get_property("_complete_timestamp")
    class_rank: int = field(default=0, repr=False)
    grade_rank: int = field(default=0, repr=False)
    is_final: bool = False

    def __bool__(self):
        return bool(self.id)

    def __eq__(self, other):
        return type(other) == type(self) and other.id == self.id
Exemplo n.º 2
0
class Person:
    """一些基本属性"""
    id: str = ""
    name: str = ""
    gender: Sex = Sex.GIRL
    email: str = ""
    mobile: str = ""
    qq_number: str = ""
    _birthday_timestamp: float = 0
    birthday = get_property("_birthday_timestamp")
    avatar: str = ""
Exemplo n.º 3
0
class Subject:
    """学科"""
    id: str = ""
    name: str = ""
    code: str = ""
    standard_score: float = 0
    status: str = field(default="", repr=False)
    exam: Exam = field(default_factory=Exam, repr=False)
    create_user: Person = field(default_factory=Person, repr=False)
    _create_timestamp: float = field(default=0, repr=False)
    create_time = get_property("_create_timestamp")

    def __eq__(self, other):
        return type(other) == type(self) and other.id == self.id
Exemplo n.º 4
0
class Person:
    """一些基本属性"""
    id: str = ""
    name: str = ""
    gender: Sex = Sex.GIRL
    email: str = ""
    mobile: str = ""
    qq_number: str = ""
    _birthday_timestamp: float = 0
    birthday = get_property("_birthday_timestamp")
    avatar: str = ""

    def __repr__(self):
        return f"Person(id={self.id}, name={self.name}, gender={self.gender}" \
               f"{f', qq_number={self.qq_number}' if self.qq_number != '' else ''}" \
               f"{f', mobile={self.mobile}' if self.mobile != '' else ''}" + ")"
Exemplo n.º 5
0
class SubjectScore:
    """一门学科的成绩"""
    score: float
    subject: Subject
    person: Person
    _create_timestamp: float = field(default=0, repr=False)
    create_time = get_property("_create_timestamp")
    class_rank: ExtraRank = field(default_factory=ExtraRank, compare=False)
    grade_rank: ExtraRank = field(default_factory=ExtraRank, compare=False)

    def __str__(self):
        msg = f"{self.subject.name}:\n分数: {self.score}\n"
        if self.class_rank:
            msg += f"班级:\n{self.class_rank}\n"
        if self.grade_rank:
            msg += f"年级:\n{self.grade_rank}\n"
        return msg[:-1]