Moved test database teardown into defer blocks and unified the one-decimal formatting in the Website service.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javierandClaude Opus 5.5 committed 2026-10-25 12:41:55 +01:00
1 parent 06953a1be0
commit e0524da525
16 files changed
+118 -146

No files matched your search

@@ -179,7 +179,7 @@ private extension ComparePage {
of copy: Listing
) -> [(term: String, value: String)] {
let customs = copy.shop.shipsFromEU ? "" : " · customs may apply"
let rating = copy.shop.rating.formatted(.number.precision(.fractionLength(1)).locale(.init(identifier: "en")))
let rating = copy.shop.rating.oneDecimal
return [
("Asking", copy.priceCents.euros + (copy.acceptsOffers ? " · accepts offers" : "")),
@@ -66,7 +66,7 @@ extension GradingGuidePage: Page {
ForEach(Grading.scale) { step in
li(.class("guide__grade")) {
strong {
step.grade.gradeLabel
step.grade.oneDecimal
}
span {
step.code
@@ -83,7 +83,7 @@ extension GradingGuidePage: Page {
li(.class("card guide__reference")) {
div(.class("guide__reference-grade")) {
span(.class("type-stat")) {
reference.grade.gradeLabel
reference.grade.oneDecimal
}
span(.class("type-label")) {
reference.name
@@ -94,7 +94,7 @@ extension GradingGuidePage: Page {
.class("guide__photo"),
.custom(name: "aria-hidden", value: "true")
) {
"Photo: \(reference.grade.gradeLabel) example"
"Photo: \(reference.grade.oneDecimal) example"
}
div {
h3(.class("type-eyebrow guide__allowed")) {
@@ -213,7 +213,7 @@ private extension NewListingPage {
mode(.raw, "Raw (seller-graded)", "You grade it against the guide and declare every defect.")
}
div(.class("listing-form__grid")) {
select(.grade, "Grade", options: [("", "Pick a grade")] + Grading.scale.map { ($0.grade.gradeLabel, "\($0.grade.gradeLabel) · \($0.code)") })
select(.grade, "Grade", options: [("", "Pick a grade")] + Grading.scale.map { ($0.grade.oneDecimal, "\($0.grade.oneDecimal) · \($0.code)") })
select(.grader, "Grader", options: [("", "—")] + Grading.graders.map { ($0, $0) }, scope: "slabbed")
select(.pageQuality, "Page quality", options: [("", "Not stated")] + Grading.pageQualities.map { ($0, $0) }, scope: "slabbed")
text(.cert, "Cert number", placeholder: "4312087-002", scope: "slabbed")
@@ -112,7 +112,7 @@ extension SellerDashboardPage: Page {
tile("\(offers.count)", "Open offers", offers.first.map { "next: \($0.expiresAt.countdown(from: now))" })
tile("\(viewer?.unreadMessages ?? 0)", "Unread conversations", nil)
tile("\(sales.count)", "Sales", "\(sales.count { $0.next == .sent }) awaiting your dispatch")
tile(shop.rating.formatted(.number.precision(.fractionLength(1)).locale(.init(identifier: "en"))), "Rating", "\(shop.ratedSales) rated sales")
tile(shop.rating.oneDecimal, "Rating", "\(shop.ratedSales) rated sales")
}
section(.class("card sell__panel")) {
div(.class("section-head")) {
@@ -219,8 +219,8 @@ private extension WantsPage {
SelectField(
name: "min-grade",
title: "Lowest grade",
options: [("", "Any grade")] + Grading.scale.map { ($0.grade.gradeLabel, "\($0.grade.gradeLabel) · \($0.code)") },
selected: draft.minGrade?.gradeLabel ?? ""
options: [("", "Any grade")] + Grading.scale.map { ($0.grade.oneDecimal, "\($0.grade.oneDecimal) · \($0.code)") },
selected: draft.minGrade?.oneDecimal ?? ""
)
TextField(
name: "max-price",
@@ -260,7 +260,7 @@ private extension WantsPage {
) -> String {
[
want.slabbedOnly ? "slabbed only" : nil,
want.minGrade.map { "grade ≥ \($0.gradeLabel)" },
want.minGrade.map { "grade ≥ \($0.oneDecimal)" },
want.maxPriceCents.map { "max \($0.euros)" },
"ships from EU only",
]
@@ -275,7 +275,7 @@ private extension WantsPage {
var parameters = SearchParameters().setting(.query, to: want.title.replacingOccurrences(of: "·", with: " "))
if let minGrade = want.minGrade {
parameters = parameters.setting(.gradeMin, to: minGrade.gradeLabel)
parameters = parameters.setting(.gradeMin, to: minGrade.oneDecimal)
}
if let maxPriceCents = want.maxPriceCents {