Skip to content

Commit bca140e

Browse files
committed
fix: status update query
1 parent 44aec13 commit bca140e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/graphql/queries/member_queries.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl MemberQueries {
7979

8080
#[Object]
8181
impl StatusInfo {
82-
async fn streak(&self, ctx: &Context<'_>) -> Result<StatusUpdateStreakRecord> {
82+
async fn streak(&self, ctx: &Context<'_>) -> Result<Option<StatusUpdateStreakRecord>> {
8383
let pool = ctx.data::<Arc<PgPool>>().expect("Pool must be in context.");
8484

8585
// The below is based on the classic 'islands and gaps' problem, adapted to fit our needs.
@@ -125,7 +125,7 @@ impl StatusInfo {
125125
.fetch_one(pool.as_ref())
126126
.await?;
127127

128-
Ok(result)
128+
Ok(Some(result))
129129
}
130130

131131
async fn update_count(
@@ -136,7 +136,7 @@ impl StatusInfo {
136136
) -> Result<i64> {
137137
let pool = ctx.data::<Arc<PgPool>>().expect("Pool must be in context.");
138138

139-
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;")
139+
let result : i64 = sqlx::query_scalar("SELECT count(*) AS updatecount FROM statusupdatehistory WHERE is_sent = TRUE and member_id=$1 and date BETWEEN $2 and $3;")
140140
.bind(self.member_id)
141141
.bind(start_date)
142142
.bind(end_date)

0 commit comments

Comments
 (0)