fix: don't add XP update if no new construct uses were added (#5027)
This commit is contained in:
parent
18bd2e4b6a
commit
a268c2a27d
1 changed files with 8 additions and 5 deletions
|
|
@ -365,13 +365,16 @@ class AnalyticsDataService {
|
|||
_mergeTable.addConstructsByUses(update.addedConstructs, blocked);
|
||||
|
||||
final newConstructs = await getConstructUses(updateIds);
|
||||
|
||||
int points = 0;
|
||||
for (final id in updateIds) {
|
||||
final prevPoints = prevConstructs[id]?.points ?? 0;
|
||||
final newPoints = newConstructs[id]?.points ?? 0;
|
||||
points += (newPoints - prevPoints);
|
||||
if (updateIds.isNotEmpty) {
|
||||
for (final id in updateIds) {
|
||||
final prevPoints = prevConstructs[id]?.points ?? 0;
|
||||
final newPoints = newConstructs[id]?.points ?? 0;
|
||||
points += (newPoints - prevPoints);
|
||||
}
|
||||
events.add(XPGainedEvent(points, update.targetID));
|
||||
}
|
||||
events.add(XPGainedEvent(points, update.targetID));
|
||||
|
||||
final newData = prevData.copyWith(totalXP: prevData.totalXP + points);
|
||||
await _analyticsClientGetter.database.updateDerivedStats(newData);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue