satellite/payments/stripecoinpayments: fix listing issue in

InvoiceApplyProjectRecords

ListUnapplied method in listing loop  was using next offset as starting
point but applyProjectRecords method was changing project record state
to applied and we were missing some records to apply.

Test will be added as a separate change.

Change-Id: Id1ca33eeb66ec7f6ff1f05b45615a8935185568e
This commit is contained in:
Michal Niewrzal 2020-05-18 15:01:26 +02:00
parent 4544f2dffb
commit 9fb423ac19

View File

@ -560,7 +560,8 @@ func (service *Service) InvoiceApplyProjectRecords(ctx context.Context, period t
return Error.Wrap(err)
}
recordsPage, err = service.db.ProjectRecords().ListUnapplied(ctx, recordsPage.NextOffset, fetchLimit, start, end)
// we are always starting from offset 0 because applyProjectRecords is changing project record state to applied
recordsPage, err = service.db.ProjectRecords().ListUnapplied(ctx, 0, fetchLimit, start, end)
if err != nil {
return Error.Wrap(err)
}