Commit 33f697b

Anton Medvedev <anton@medv.io>
2023-10-12 21:59:13
Fix compat with old data
1 parent 62807c5
Changed files (1)
src/main.ts
@@ -95,6 +95,11 @@ void (async function main() {
       )
       jsonSha = myBadgesResp.data.sha
       userBadges = JSON.parse(oldJson)
+
+      // Add missing tier property in old my-badges.json.
+      for (const b of userBadges) {
+        if (b.tier === undefined) b.tier = 0
+      }
     } catch (err) {
       if (err instanceof RequestError && err.response?.status != 404) {
         throw err