Skip to content

Commit 5eaf954

Browse files
committed
feat: add statusUpdateCountByDate query to get status update count of a member between two dates
1 parent efc6c51 commit 5eaf954

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/graphql/queries/member_queries.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use async_graphql::{ComplexObject, Context, Object, Result};
22
use sqlx::PgPool;
33
use std::sync::Arc;
4-
use chrono::NaiveDate;
5-
64

75
use crate::models::{
86
attendance::{AttendanceInfo, AttendanceSummaryInfo},
@@ -118,7 +116,7 @@ impl Member {
118116

119117
let pool = ctx.data::<Arc<PgPool>>().expect("Pool must be in context.");
120118

121-
let result : i64 = sqlx::query_scalar("SELECT count(*) as updatecount from statusupdatehistory where is_updated='t' and member_id=$1 and date between $2 and $3;")
119+
let result : i64 = sqlx::query_scalar("SELECT count(*) AS updatecount FROM statusupdatehistory WHERE is_updated = TRUE and member_id=$1 and date BETWEEN $2 and $3;")
122120
.bind(self.member_id)
123121
.bind(start_date)
124122
.bind(end_date)

0 commit comments

Comments
 (0)