Skip to content

Commit 2752dea

Browse files
committed
fix PR comments
1 parent a2cabe2 commit 2752dea

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

sentry/src/db/accounting.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ use tokio_postgres::{
1111
use super::{DbPool, PoolError};
1212
use thiserror::Error;
1313

14+
static UPDATE_ACCOUNTING_STATEMENT: &str = "INSERT INTO accounting(channel_id, side, address, amount, updated, created) VALUES($1, $2, $3, $4, $5, $6) ON CONFLICT ON CONSTRAINT accounting_pkey DO UPDATE SET amount = accounting.amount + $4, updated = $6 WHERE accounting.channel_id = $1 AND accounting.side = $2 AND accounting.address = $3 RETURNING channel_id, side, address, amount, updated, created";
15+
1416
#[derive(Debug, Error)]
1517
pub enum Error {
1618
#[error("Accounting Balances error: {0}")]
@@ -84,7 +86,6 @@ pub async fn get_accounting(
8486
/// Will update current Spender/Earner amount or insert a new Accounting record
8587
///
8688
/// See `UPDATE_ACCOUNTING_STATEMENT` static for full query.
87-
static UPDATE_ACCOUNTING_STATEMENT: &str = "INSERT INTO accounting(channel_id, side, address, amount, updated, created) VALUES($1, $2, $3, $4, $5, $6) ON CONFLICT ON CONSTRAINT accounting_pkey DO UPDATE SET amount = accounting.amount + $4, updated = $6 WHERE accounting.channel_id = $1 AND accounting.side = $2 AND accounting.address = $3 RETURNING channel_id, side, address, amount, updated, created";
8889
pub async fn update_accounting(
8990
pool: DbPool,
9091
channel_id: ChannelId,
@@ -204,7 +205,7 @@ mod test {
204205
.expect("Should insert");
205206
assert_eq!(spender, inserted.address);
206207
assert_eq!(Side::Spender, inserted.side);
207-
assert_eq!(UnifiedNum::from(100_000_000), inserted.amount);
208+
assert_eq!(amount, inserted.amount);
208209

209210
let updated = update_accounting(
210211
database.pool.clone(),
@@ -218,7 +219,7 @@ mod test {
218219
assert_eq!(spender, updated.address);
219220
assert_eq!(Side::Spender, updated.side);
220221
assert_eq!(
221-
UnifiedNum::from(300_000_000),
222+
amount + update_amount,
222223
updated.amount,
223224
"Should add the newly spent amount to the existing one"
224225
);
@@ -247,7 +248,7 @@ mod test {
247248
.expect("Should insert");
248249
assert_eq!(earner, inserted.address);
249250
assert_eq!(Side::Earner, inserted.side);
250-
assert_eq!(UnifiedNum::from(100_000_000), inserted.amount);
251+
assert_eq!(amount, inserted.amount);
251252

252253
let updated = update_accounting(
253254
database.pool.clone(),
@@ -261,7 +262,7 @@ mod test {
261262
assert_eq!(earner, updated.address);
262263
assert_eq!(Side::Earner, updated.side);
263264
assert_eq!(
264-
UnifiedNum::from(300_000_000),
265+
amount + update_amount,
265266
updated.amount,
266267
"Should add the newly earned amount to the existing one"
267268
);
@@ -293,7 +294,7 @@ mod test {
293294
.expect("Should insert");
294295
assert_eq!(spender_as_earner, inserted.address);
295296
assert_eq!(Side::Earner, inserted.side);
296-
assert_eq!(UnifiedNum::from(100_000_000), inserted.amount);
297+
assert_eq!(amount, inserted.amount);
297298

298299
let updated = update_accounting(
299300
database.pool.clone(),

sentry/src/routes/campaign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ pub mod insert_events {
435435
.await;
436436

437437
assert!(
438-
dbg!(spend_event).is_ok(),
438+
spend_event.is_ok(),
439439
"Campaign budget has no remaining funds to spend"
440440
);
441441

0 commit comments

Comments
 (0)