Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dao: order debit notes by ts, desc #1717

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/payment/src/dao/debit_note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl<'c> DebitNoteDao<'c> {

pub async fn get_all(&self) -> DbResult<Vec<DebitNote>> {
readonly_transaction(self.pool, move |conn| {
let debit_notes: Vec<ReadObj> = query!().load(conn)?;
let debit_notes: Vec<ReadObj> = query!().order_by(dsl::timestamp.desc()).load(conn)?;
debit_notes.into_iter().map(TryInto::try_into).collect()
})
.await
Expand All @@ -212,6 +212,7 @@ impl<'c> DebitNoteDao<'c> {
if let Some(date) = after_timestamp {
query = query.filter(dsl::timestamp.gt(date))
}
query = query.order_by(dsl::timestamp.desc());
if let Some(items) = max_items {
query = query.limit(items.into())
}
Expand Down
2 changes: 1 addition & 1 deletion goth_tests/domain/exe_units/test_runtime_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def test_custom_runtime_counter(
)

debit_notes = await requestor.api.payment.get_debit_notes()
last_debit_note = debit_notes[-1]
last_debit_note = debit_notes[0]
logger.info("last debit note: %r", last_debit_note)

assert len(last_debit_note.usage_counter_vector) == len(usage_vector)
Expand Down