Exemplo n.º 1
0
def groups(faculty_id: int=None) -> list:
    """
        Return collection of groups

        :param faculty_id - course ID.
    """
    return get("groups", facultyOid=faculty_id)
Exemplo n.º 2
0
def auditoriums(building_id: int=None) -> list:
    """
        Return collection of auditoriums

        :param building_id - ID of building.
    """
    return get("auditoriums", buildingOid=building_id)
Exemplo n.º 3
0
def chairs(faculty_id: int=None) -> list:
    """
        Return collection of departments

        :param faculty_id - ID of course (learning program).
    """
    return get("chairs", facultyOid=faculty_id)
Exemplo n.º 4
0
def lecturers(chair_id: int=None) -> list:
    """
        Return collection of teachers

        :param chair_id - ID of department.
    """
    return get("lecturers", chairOid=chair_id)
Exemplo n.º 5
0
def staff_of_group(group_id: int) -> list:
    """
        Return collection of students in group

        :param group_id, required - group' ID.
    """
    return get("staffOfGroup", groupOid=group_id)
Exemplo n.º 6
0
def sub_groups(reset_cache: bool=False) -> list:
    """
        Return collection of subgroups

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("subGroups")
Exemplo n.º 7
0
def faculties(reset_cache: bool=False) -> list:
    """
        Return collection of learning programs

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("faculties")
Exemplo n.º 8
0
def buildings(reset_cache: bool=False) -> list:
    """
        Return collection of buildings

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("buildings")
Exemplo n.º 9
0
def kind_of_works(reset_cache: bool=False) -> list:
    """
        Return collection of classes' types

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("kindOfWorks")
Exemplo n.º 10
0
def type_of_auditoriums(reset_cache: bool=False) -> list:
    """
        Return collection of auditoriums' types

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("typeOfAuditoriums")
Exemplo n.º 11
0
def streams(reset_cache: bool=False) -> list:
    """
        Return collection of study streams

        Cache requested values.
        :param reset - use to reset cached value.
    """
    return get("streams")
Exemplo n.º 12
0
def person_lessons(email: str=None,
                   from_date: str=get_formated_date(),
                   to_date: str=get_formated_date(6),  # one week
                   receiver_type: int=None,
                   lecturer_id: int=None,
                   auditorium_id: int=None,
                   student_id: int=None,
                   **params) -> list:
    """
        Return classes schedule (for week by default)

        Automatically choose receiver type from given email address.
        There is no need to specify receiver type for students explicitly.
        One of the followed required: lecturer_id, auditorium_id,
            student_id, email. Throws an exception.
        Default values (fromDate, toDate) are set to return schedule for
            one week from now.

        :param email - email on hse.ru (edu.hse.ru for students).
        :param from_date, required - start of the period YYYY.MM.DD.
        :param to_date, required - end of the period YYYY.MM.DD.
        :param receiver_type - type of the schedule
            (1/2/3 for teacher/auditorium/student).
        :param lecturer_id - ID of teacher.
        :param auditorium_id - ID of auditorium.
        :param student_id - ID of student.
        :param check_online :type bool - online verification for email.
        :param safe :type bool - return something even if no data received.
    """
    if receiver_type is None:
        if email is not None and not is_student(email):
            logging.debug("Detect lecturer email: '%s'.", email)
            receiver_type = 1
        elif lecturer_id is not None:
            logging.debug("Detect lecturer %d.", lecturer_id)
            receiver_type = 1
        elif auditorium_id is not None:
            logging.debug("Detect auditorium %d.", auditorium_id)
            receiver_type = 2
    elif receiver_type == 3:
        receiver_type = None

    return get(
        "schedule",
        fromDate=from_date,
        toDate=to_date,
        email=email,
        receiverType=receiver_type,
        lecturerOid=lecturer_id,
        auditoriumOid=auditorium_id,
        studentOid=student_id,
        **params
    )