mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 21:38:06 +03:00
This is far from perfect (or everything), but in theory provides a better experience.
19 lines
568 B
Markdown
19 lines
568 B
Markdown
# Goal ID implementation
|
|
|
|
Goal IDs exist to dedupe goals when a user creates
|
|
a new goal. For example, if a user wants to create a
|
|
HARD CLEAR Mei goal, but one already exists, we should
|
|
not insert two [Goal Documents](../../schemas/goal.md)
|
|
representing the same thing.
|
|
|
|
*****
|
|
|
|
## Hashing
|
|
|
|
To create the Goal ID, we perform a [JSON stable hash](https://github.com/zkrising/fast-json-stable-hash) on the
|
|
`game`, `playtype`, `charts` and `criteria` of this field.
|
|
|
|
This enforces that goals are unique on those fields.
|
|
|
|
The above hash is then returned, prefixed with `G`.
|