mirror of
https://github.com/osmarks/website
synced 2025-01-11 09:50:28 +00:00
fix achievement system for new users
This commit is contained in:
parent
d8ee33cd78
commit
d0feda98e1
@ -154,6 +154,8 @@ window.points = (async () => {
|
||||
}
|
||||
}
|
||||
|
||||
let [metrics, pointsData] = [{}, {}]
|
||||
try {
|
||||
const [oldMetrics, oldPoints] = await Promise.all([idb.openDB("arbitrary-metrics"), idb.openDB("arbitrary-points")])
|
||||
const getMetrics = async () => {
|
||||
const metrics = {}
|
||||
@ -171,10 +173,14 @@ window.points = (async () => {
|
||||
}
|
||||
return data
|
||||
}
|
||||
const [metrics, pointsData] = await Promise.all([getMetrics(), getPointsData()])
|
||||
[metrics, pointsData] = await Promise.all([getMetrics(), getPointsData()])
|
||||
await Promise.all([oldMetrics.close(), oldPoints.close()])
|
||||
} catch(e) {
|
||||
console.warn("old achievements not loaded due to", e)
|
||||
}
|
||||
const db = await idb.openDB("arbitrary-data", 1, {
|
||||
async upgrade(db, oldVersion, newVersion, tx) {
|
||||
console.log("migrating", oldVersion, newVersion)
|
||||
if (!oldVersion || oldVersion < 1) {
|
||||
// create metrics, KV, achievements stores
|
||||
db.createObjectStore("kv")
|
||||
|
Loading…
Reference in New Issue
Block a user