Skip to content

Commit

Permalink
added extra feilds on get course (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupiter-is-BIG authored Mar 27, 2024
1 parent 133624e commit 3e76231
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
13 changes: 11 additions & 2 deletions app/routes/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,11 @@ async def get_courses(
status=course.status,
teacher_name=f"{teacher_profile.first_name} {teacher_profile.last_name}"
),
assignments=assigments
assignments=assigments,
teacher_email=teacher_profile.email,
teacher_profile_url=teacher_profile.profile_image,
teacher_office=teacher.office,
teacher_contact=teacher.contact
)

return response
Expand Down Expand Up @@ -770,7 +774,12 @@ async def get_courses(
status=course.status,
teacher_name=f"{teacher_profile.first_name} {teacher_profile.last_name}"
),
assignments = list_of_submission
assignments = list_of_submission,
teacher_email=teacher_profile.email,
teacher_profile_url=teacher_profile.profile_image,
teacher_office=teacher.office,
teacher_contact=teacher.contact

)

return response
Expand Down
9 changes: 9 additions & 0 deletions app/schemas/course_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class OneStudentCourse(BaseModel):
role: user_model.RoleEnum
meta: Course
assignments: List[StudentAssignments]
teacher_email: str
teacher_profile_url: Optional[str]
teacher_office: Optional[str]
teacher_contact: Optional[str]

class Config:
from_attributes = True
Expand Down Expand Up @@ -118,6 +122,11 @@ class OneTeacherCourse(BaseModel):
role: user_model.RoleEnum
meta: Course
assignments: List[TeacherAssignments]
teacher_email: str
teacher_profile_url: Optional[str]
teacher_office: Optional[str]
teacher_contact: Optional[str]


class Config:
from_attributes = True
4 changes: 2 additions & 2 deletions app/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,15 @@ def populatedb(db: Session = Depends(get_db)):
# add assignments
assignment_1 = course_model.Assignment(
title="Intro to Computing",
file_url="htttp://0.0.0.0:8000/data/assignment/test.txt",
file_url="http://0.0.0.0:8000/data/assignment/test.txt",
deadline="2024-04-30 23:59:00.0-07",
total_grade="100",
course_id = course_1.id
)

assignment_2 = course_model.Assignment(
title="Intro to Computing 2",
file_url="htttp://0.0.0.0:8000/data/assignment/test.txt",
file_url="http://0.0.0.0:8000/data/assignment/test.txt",
deadline="2024-04-30 23:59:00.0-07",
total_grade="50",
course_id = course_1.id
Expand Down
Binary file modified test/__pycache__/test_fixtures.cpython-311-pytest-8.0.2.pyc
Binary file not shown.

0 comments on commit 3e76231

Please sign in to comment.