Skip to content

Commit

Permalink
Merge pull request #54 from amfoss/develop
Browse files Browse the repository at this point in the history
fix bugs in attendance_mutations
  • Loading branch information
ivinjabraham authored Feb 8, 2025
2 parents f2b813c + ff851c7 commit c3a7563
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/graphql/mutations/attendance_mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ impl AttendanceMutations {
return Err(async_graphql::Error::new("HMAC verification failed"));
}

let now = Local::now().with_timezone(&Kolkata).date_naive();
let now = Local::now().with_timezone(&Kolkata).time();
let attendance = sqlx::query_as::<_, Attendance>(
"UPDATE Attendance SET time_in = CASE
WHEN time_in IN NULL THEN $1
WHEN time_in IS NULL THEN $1
ELSE time_in END,
time_out = $1
WHERE id = $2 AND date = $3 RETURNING *
time_out = $1,
is_present = TRUE
WHERE member_id = $2 AND date = $3 RETURNING *
",
)
.bind(now)
Expand Down
2 changes: 1 addition & 1 deletion src/models/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct CreateMemberInput {
pub roll_no: String,
pub name: String,
pub email: String,
pub sex: String,
pub sex: Sex,
pub year: i32,
pub hostel: String,
pub mac_address: String,
Expand Down

0 comments on commit c3a7563

Please sign in to comment.