@shaxpir/duiduidui-models 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/models/Progress.js +20 -1
- package/package.json +1 -1
package/dist/models/Progress.js
CHANGED
|
@@ -131,7 +131,26 @@ class Progress extends Content_1.Content {
|
|
|
131
131
|
this.checkDisposed("Progress.setStreaks");
|
|
132
132
|
if (!shaxpir_common_1.Struct.equals(this.payload.streaks, streaks)) {
|
|
133
133
|
const batch = new Operation_1.BatchOperation(this);
|
|
134
|
-
|
|
134
|
+
// If streaks already exist, do field-by-field updates for more granular OT ops
|
|
135
|
+
if (this.payload.streaks) {
|
|
136
|
+
// Update daily streak fields
|
|
137
|
+
batch.setPathValue(['payload', 'streaks', 'daily', 'current'], streaks.daily.current);
|
|
138
|
+
batch.setPathValue(['payload', 'streaks', 'daily', 'longest'], streaks.daily.longest);
|
|
139
|
+
// Update weekly streak
|
|
140
|
+
batch.setPathValue(['payload', 'streaks', 'weekly', 'current'], streaks.weekly.current);
|
|
141
|
+
// Update monthly streak
|
|
142
|
+
batch.setPathValue(['payload', 'streaks', 'monthly', 'current'], streaks.monthly.current);
|
|
143
|
+
// Update last_activity fields
|
|
144
|
+
batch.setPathValue(['payload', 'streaks', 'last_activity', 'date'], streaks.last_activity.date);
|
|
145
|
+
batch.setPathValue(['payload', 'streaks', 'last_activity', 'week'], streaks.last_activity.week);
|
|
146
|
+
batch.setPathValue(['payload', 'streaks', 'last_activity', 'month'], streaks.last_activity.month);
|
|
147
|
+
// Update total_days
|
|
148
|
+
batch.setPathValue(['payload', 'streaks', 'total_days'], streaks.total_days);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// No existing streaks, set the entire object
|
|
152
|
+
batch.setPathValue(['payload', 'streaks'], streaks);
|
|
153
|
+
}
|
|
135
154
|
batch.commit();
|
|
136
155
|
}
|
|
137
156
|
}
|