Skip to content

Commit 8a84199

Browse files
committed
fix: streak query edge case for null values
1 parent e7a882e commit 8a84199

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/graphql/queries/member_queries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl StatusInfo {
9898
Ok(rows)
9999
}
100100

101-
async fn streak(&self, ctx: &Context<'_>) -> Result<Option<StatusUpdateStreakRecord>> {
101+
async fn streak(&self, ctx: &Context<'_>) -> Result<StatusUpdateStreakRecord> {
102102
let pool = ctx.data::<Arc<PgPool>>().expect("Pool must be in context.");
103103

104104
// The below is based on the classic 'islands and gaps' problem, adapted to fit our needs.
@@ -144,7 +144,7 @@ impl StatusInfo {
144144
.fetch_one(pool.as_ref())
145145
.await?;
146146

147-
Ok(Some(result))
147+
Ok(result)
148148
}
149149

150150
async fn update_count(

src/models/status_update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ pub struct StatusUpdateRecord {
1212

1313
#[derive(SimpleObject, FromRow)]
1414
pub struct StatusUpdateStreakRecord {
15-
pub current_streak: i64,
16-
pub max_streak: i64,
15+
pub current_streak: Option<i64>,
16+
pub max_streak: Option<i64>,
1717
}

0 commit comments

Comments
 (0)