Skip to content

Commit c3a7563

Browse files
authored
Merge pull request #54 from amfoss/develop
fix bugs in attendance_mutations
2 parents f2b813c + ff851c7 commit c3a7563

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/graphql/mutations/attendance_mutations.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ impl AttendanceMutations {
4242
return Err(async_graphql::Error::new("HMAC verification failed"));
4343
}
4444

45-
let now = Local::now().with_timezone(&Kolkata).date_naive();
45+
let now = Local::now().with_timezone(&Kolkata).time();
4646
let attendance = sqlx::query_as::<_, Attendance>(
4747
"UPDATE Attendance SET time_in = CASE
48-
WHEN time_in IN NULL THEN $1
48+
WHEN time_in IS NULL THEN $1
4949
ELSE time_in END,
50-
time_out = $1
51-
WHERE id = $2 AND date = $3 RETURNING *
50+
time_out = $1,
51+
is_present = TRUE
52+
WHERE member_id = $2 AND date = $3 RETURNING *
5253
",
5354
)
5455
.bind(now)

src/models/member.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct CreateMemberInput {
3333
pub roll_no: String,
3434
pub name: String,
3535
pub email: String,
36-
pub sex: String,
36+
pub sex: Sex,
3737
pub year: i32,
3838
pub hostel: String,
3939
pub mac_address: String,

0 commit comments

Comments
 (0)