Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Krrupa committed Apr 9, 2024
1 parent b0179d1 commit 2bb44e5
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions app/router/student.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ async def create_school_user_record(data, school_name):
await group_user.create_group_user(
build_request(
method="POST",
body={"group_id": group_data[0]["id"], "user_id": data["user"]["id"], "academic_year": str(datetime.now().year)
+ "-"
+ str((datetime.now() + relativedelta(years=1)).year),"start_date": datetime.now().strftime("%Y-%m-%d"), "grade_id": data["grade_id"]},
body={
"group_id": group_data[0]["id"],
"user_id": data["user"]["id"],
"academic_year": str(datetime.now().year)
+ "-"
+ str((datetime.now() + relativedelta(years=1)).year),
"start_date": datetime.now().strftime("%Y-%m-%d"),
"grade_id": data["grade_id"],
},
)
)

Expand All @@ -84,12 +90,20 @@ async def create_auth_group_user_record(data, auth_group_name):
query_params={"child_id": auth_group_data["id"], "type": "auth_group"}
)
)

await group_user.create_group_user(
build_request(
method="POST",
body={"group_id": group_data[0]["id"], "user_id": data["user"]["id"], "academic_year": str(datetime.now().year) + "-" + str((datetime.now() + relativedelta(years=1)).year),"start_date": datetime.now().strftime("%Y-%m-%d"),"grade_id": data["grade_id"],
})
body={
"group_id": group_data[0]["id"],
"user_id": data["user"]["id"],
"academic_year": str(datetime.now().year)
+ "-"
+ str((datetime.now() + relativedelta(years=1)).year),
"start_date": datetime.now().strftime("%Y-%m-%d"),
"grade_id": data["grade_id"],
},
)
)


Expand Down Expand Up @@ -246,18 +260,19 @@ async def create_student(request: Request):
student_id = query_params["phone"]
query_params["student_id"] = student_id

student_id_already_exists = await verify_student(build_request(), student_id=student_id)
student_id_already_exists = await verify_student(
build_request(), student_id=student_id
)

if student_id_already_exists:
return student_id

if "grade" in query_params:
student_grade_id = grade.get_grade(
build_request(query_params={"number": int(query_params["grade"])})
)
query_params["grade_id"] = student_grade_id["id"]


if "physically_handicapped" in query_params:
query_params["physically_handicapped"] = (
"true" if query_params["physically_handicapped"] == "Yes" else "false"
Expand Down

0 comments on commit 2bb44e5

Please sign in to comment.