Skip to content

Commit

Permalink
fix(analytics)!: correctly count aliases and NFT activity (#943)
Browse files Browse the repository at this point in the history
* fix(analytics): count changed aliases and NFTs correctly

* fmt
  • Loading branch information
grtlr authored Nov 30, 2022
1 parent 7e0c0da commit e5b5f0b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/db/collections/outputs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,12 @@ mod analytics {
} },
],
"nft_changed": [
{ "$match": { "output.nft_id": { "$ne": NftId::implicit() } } },
{ "$match": {
"$and": [
{ "output.nft_id": { "$exists": true } },
{ "output.nft_id": { "$ne": NftId::implicit() } },
]
} },
{ "$group": {
"_id": "$output.nft_id",
"transferred": { "$sum": { "$cond": [ { "$eq": [ "$metadata.booked.milestone_index", index ] }, 1, 0 ] } },
Expand All @@ -537,7 +542,12 @@ mod analytics {
} },
],
"alias_changed": [
{ "$match": { "output.alias_id": { "$ne": AliasId::implicit() } } },
{ "$match": {
"$and": [
{ "output.alias_id": { "$exists": true } },
{ "output.alias_id": { "$ne": AliasId::implicit() } },
]
} },
// Group by state indexes to find where it changed
{ "$group": {
"_id": { "alias_id": "$output.alias_id", "state_index": "$output.state_index" },
Expand Down

0 comments on commit e5b5f0b

Please sign in to comment.