3
3
import eu .pretix .libpretixsync .api .*;
4
4
import eu .pretix .libpretixsync .models .Question ;
5
5
import eu .pretix .libpretixsync .models .db .QuestionExtensionsKt ;
6
+ import eu .pretix .libpretixsync .sqldelight .Closing ;
7
+ import eu .pretix .libpretixsync .sqldelight .ClosingExtensionsKt ;
6
8
import eu .pretix .libpretixsync .sqldelight .QueuedCall ;
7
9
import eu .pretix .libpretixsync .sqldelight .QueuedCheckIn ;
8
10
import eu .pretix .libpretixsync .sqldelight .SyncDatabase ;
20
22
import eu .pretix .libpretixsync .SentryInterface ;
21
23
import eu .pretix .libpretixsync .config .ConfigStore ;
22
24
import eu .pretix .libpretixsync .db .Answer ;
23
- import eu .pretix .libpretixsync .db .Closing ;
24
25
import eu .pretix .libpretixsync .db .QueuedOrder ;
25
26
import eu .pretix .libpretixsync .db .Receipt ;
26
27
import eu .pretix .libpretixsync .db .ReceiptLine ;
@@ -672,10 +673,7 @@ protected void uploadOrders(ProgressFeedback feedback) throws SyncException {
672
673
protected void uploadClosings (ProgressFeedback feedback ) throws SyncException {
673
674
sentry .addBreadcrumb ("sync.queue" , "Start closings upload" );
674
675
675
- List <Closing > closings = dataStore .select (Closing .class )
676
- .where (Closing .OPEN .eq (false ))
677
- .and (Closing .SERVER_ID .isNull ())
678
- .get ().toList ();
676
+ List <Closing > closings = db .getClosingQueries ().selectClosedWithoutServerId ().executeAsList ();
679
677
680
678
try {
681
679
int i = 0 ;
@@ -686,11 +684,10 @@ protected void uploadClosings(ProgressFeedback feedback) throws SyncException {
686
684
i ++;
687
685
PretixApi .ApiResponse response = api .postResource (
688
686
api .organizerResourceUrl ("posdevices/" + configStore .getPosId () + "/closings" ),
689
- closing .toJSON ()
687
+ ClosingExtensionsKt .toJSON (closing )
690
688
);
691
689
if (response .getResponse ().code () == 201 ) {
692
- closing .setServer_id (response .getData ().getLong ("closing_id" ));
693
- dataStore .update (closing );
690
+ db .getClosingQueries ().updateServerId (response .getData ().getLong ("closing_id" ), closing .getId ());
694
691
} else {
695
692
throw new SyncException (response .getData ().toString ());
696
693
}
0 commit comments