We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66c27db commit fd5d55aCopy full SHA for fd5d55a
2 files changed
CubeSight/Database/Model/DerivableRequest+GRDBCard.swift
@@ -0,0 +1,11 @@
1
+import Foundation
2
+import GRDB
3
+
4
+extension DerivableRequest<GRDBCard> {
5
+ func filter(colors: [ScryfallColor]) -> Self {
6
+ self.joining(
7
+ required: GRDBCard.colors.filter { colors.contains($0.color) }
8
+ )
9
+ .distinct()
10
+ }
11
+}
CubeSightTests/CardColorTests.swift
@@ -25,11 +25,7 @@ struct CardColorTests {
25
let db = try await makeAppDatabase()
26
27
let count = try await db.reader.read { db in
28
- try GRDBCard.joining(
29
- required: GRDBCard.colors.filter { tc.colors.contains($0.color) }
30
- )
31
- .distinct()
32
- .fetchCount(db)
+ return try GRDBCard.all().filter(colors: tc.colors).fetchCount(db)
33
}
34
#expect(count == tc.expectedCount)
35
0 commit comments