Fix stale story-unlock and post-evolve weapon state

This commit is contained in:
Ilya Groshev
2026-05-01 16:22:24 +03:00
parent 3fe564cb1d
commit 20d8e4d3df
4 changed files with 145 additions and 11 deletions
+6 -7
View File
@@ -294,17 +294,16 @@ func ComputeDelta(before, after *store.UserState, changedTables []string) map[st
diff := make(map[string]*pb.DiffData, len(changedTables))
for _, table := range changedTables {
afterJSON := projectTable(table, *after)
updates := afterJSON
deleteKeys := "[]"
if kf := keyFieldsForTable(table); len(kf) > 0 {
beforeJSON := projectTable(table, *before)
deleteKeys = ComputeDeleteKeys(
parseJSONRecords(beforeJSON),
parseJSONRecords(afterJSON),
kf,
)
beforeRecs := parseJSONRecords(projectTable(table, *before))
afterRecs := parseJSONRecords(afterJSON)
updates = ComputeUpdateRecords(beforeRecs, afterRecs, kf)
deleteKeys = ComputeDeleteKeys(beforeRecs, afterRecs, kf)
}
diff[table] = &pb.DiffData{
UpdateRecordsJson: afterJSON,
UpdateRecordsJson: updates,
DeleteKeysJson: deleteKeys,
}
}