05/15 Update: show issue's images, push notifications
This commit is contained in:
@@ -126,11 +126,24 @@ final class LocalInspection {
|
||||
var earned = 0
|
||||
|
||||
for field in scoreable {
|
||||
guard let fid = field["id"] as? String ?? (field["id"].map { "\($0)" }),
|
||||
let ftype = field["type"] as? String
|
||||
else { continue }
|
||||
// Explicit cast required — field["id"] arrives as Int from JSONSerialization.
|
||||
// Using Optional.map { "\($0)" } on Any? wraps in a second Optional,
|
||||
// producing "Optional(5)" instead of "5", so all formData lookups miss
|
||||
// and scores silently return 0 (CLAUDE.md rule 34).
|
||||
let fid: String
|
||||
if let s = field["id"] as? String { fid = s }
|
||||
else if let n = field["id"] as? Int { fid = String(n) }
|
||||
else { continue }
|
||||
guard let ftype = field["type"] as? String else { continue }
|
||||
|
||||
let val = formData[fid].map { "\($0)" } ?? ""
|
||||
// Same cast-first pattern for the stored value — formData values may be
|
||||
// String, Int, or Bool depending on field type.
|
||||
let rawVal = formData[fid]
|
||||
let val: String
|
||||
if let s = rawVal as? String { val = s }
|
||||
else if let n = rawVal as? Int { val = String(n) }
|
||||
else if let b = rawVal as? Bool { val = b ? "true" : "false" }
|
||||
else { val = "" }
|
||||
|
||||
switch ftype {
|
||||
case "rating":
|
||||
|
||||
Reference in New Issue
Block a user