Benjamin Harris vor 2 Monaten
Ursprung
Commit
bc3490f
2 geänderte Dateien mit 9 neuen und 4 gelöschten Zeilen
  1. 2 1
      .claude/settings.local.json
  2. 7 3
      lib/enrich.rb

+ 2 - 1
.claude/settings.local.json

@@ -8,7 +8,8 @@
       "Bash(grep -n -B3 \"^\\\\s*rescue\\\\s*$\\\\|^rescue\\\\s*$\" \"f:/GIT_REPO/tas_councils/scrapers/centralcoast.rb\" \"f:/GIT_REPO/tas_councils/scrapers/circularhead.rb\" \"f:/GIT_REPO/tas_councils/scrapers/clarence.rb\" \"f:/GIT_REPO/tas_councils/scrapers/flinders_council.rb\" \"f:/GIT_REPO/tas_councils/scrapers/georgetown.rb\" \"f:/GIT_REPO/tas_councils/scrapers/glamorgan.rb\" \"f:/GIT_REPO/tas_councils/scrapers/glenorchy.rb\" \"f:/GIT_REPO/tas_councils/scrapers/huonvalley.rb\" \"f:/GIT_REPO/tas_councils/scrapers/tasman.rb\" \"f:/GIT_REPO/tas_councils/scrapers/westtamar.rb\" \"f:/GIT_REPO/tas_councils/scrapers/meandervalley.rb\" \"f:/GIT_REPO/tas_councils/scrapers/devonportcity.rb\" \"f:/GIT_REPO/tas_councils/scrapers/dorset.rb\" \"f:/GIT_REPO/tas_councils/scrapers/launcestoncity.rb\" \"f:/GIT_REPO/tas_councils/scrapers/waratah_wynyard.rb\")",
       "Bash(ruby test/test_util.rb)",
       "Bash(docker compose:*)",
-      "Bash(python3)"
+      "Bash(python3)",
+      "Bash(python3 -c ':*)"
     ]
   }
 }

+ 7 - 3
lib/enrich.rb

@@ -103,11 +103,15 @@ def enrich_after_upsert!(table:, council_reference:, address:)
         title = (resp["title_id"] || "").to_s
         upd = DB.client.prepare(
           "UPDATE `#{esc}` SET " \
-          "property_id    = IF(? <> ‘’, ?, property_id), " \
-          "title_reference = IF(? <> ‘’, ?, title_reference) " \
+          "property_id     = COALESCE(?, property_id), " \
+          "title_reference = COALESCE(?, title_reference) " \
           "WHERE council_reference = ? AND address = ?"
         )
-        upd.execute(pid, pid, title, title, council_reference, address)
+        upd.execute(
+          pid.empty?   ? nil : pid,
+          title.empty? ? nil : title,
+          council_reference, address
+        )
         Log.debug "enrich", "lookup ok #{table} #{council_reference} pid=#{pid} title=#{title}"
       else
         Log.warn "enrich", "lookup error #{table} #{council_reference}: #{resp["error"]}"