Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix bugs in attendance_mutations #54

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading