File tree Expand file tree Collapse file tree 5 files changed +16
-6
lines changed
java/eu/pretix/libpretixsync/sync
sqldelight/common/eu/pretix/libpretixsync/sqldelight Expand file tree Collapse file tree 5 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -75,5 +75,8 @@ class ItemCategorySyncAdapter(
7575 }
7676
7777 override fun runBatch (parameterBatch : List <Long >): List <ItemCategory > =
78- db.itemCategoryQueries.selectByServerIdList(parameterBatch).executeAsList()
78+ db.itemCategoryQueries.selectByServerIdListAndEventSlug(
79+ server_id = parameterBatch,
80+ event_slug = eventSlug,
81+ ).executeAsList()
7982}
Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ class ItemSyncAdapter(
150150 }
151151
152152 override fun runBatch (parameterBatch : List <Long >): List <Item > =
153- db.itemQueries.selectByServerIdList(parameterBatch).executeAsList()
153+ db.itemQueries.selectByServerIdListAndEventSlug(
154+ server_id = parameterBatch,
155+ event_slug = eventSlug,
156+ ).executeAsList()
154157
155158 @Throws(JSONException ::class )
156159 fun standaloneRefreshFromJSON (data : JSONObject ) {
Original file line number Diff line number Diff line change @@ -508,6 +508,10 @@ class OrderSyncAdapter(
508508 }
509509
510510 override fun runBatch (parameterBatch : List <String >): List <Order > {
511+ // pretix guarantees uniqueness of CODE within an organizer account, so we don't need
512+ // to filter by EVENT_SLUG. This is good, because SQLite tends to build a very stupid
513+ // query plan otherwise if statistics are not up to date (using the EVENT_SLUG index
514+ // instead of using the CODE index)
511515 return db.orderQueries.selectByCodeList(parameterBatch).executeAsList()
512516 }
513517
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ SELECT *
1212FROM Item
1313WHERE id = ?;
1414
15- selectByServerIdList :
15+ selectByServerIdListAndEventSlug :
1616SELECT *
1717FROM Item
18- WHERE server_id IN ?;
18+ WHERE server_id IN ? AND event_slug = ? ;
1919
2020selectServerIdsByEventSlug:
2121SELECT server_id
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ SELECT *
88FROM ItemCategory
99WHERE server_id = ?;
1010
11- selectByServerIdList :
11+ selectByServerIdListAndEventSlug :
1212SELECT *
1313FROM ItemCategory
14- WHERE server_id IN ?;
14+ WHERE server_id IN ? AND event_slug = ? ;
1515
1616selectServerIdsByEventSlug:
1717SELECT server_id
You can’t perform that action at this time.
0 commit comments