1- import 'package:cloud_firestore/cloud_firestore.dart' ;
21import 'package:codelessly_api/codelessly_api.dart' ;
32
43import '../constants.dart' ;
@@ -35,10 +34,6 @@ abstract class StatTracker {
3534/// A [StatTracker] implementation that utilizes Firestore to track the
3635/// statistics.
3736final class FirestoreStatTracker extends StatTracker {
38- /// The Firestore document reference to track the statistics.
39- DocumentReference get ref => FirebaseFirestore .instance
40- .collection (statsCollection)
41- .doc (projectId ?? lostStatsDoc);
4237
4338 /// The field name to track the number of each operation.
4439 final Map <String , int > statBatch = {};
@@ -50,19 +45,7 @@ final class FirestoreStatTracker extends StatTracker {
5045 /// Sends the batch of stats to the Firestore.
5146 Future <void > sendBatch () => debouncer.run (
5247 () async {
53- // No need to await it. Send it and immediately start collecting more
54- // stats.
55- ref.set (
56- {
57- for (final entry in statBatch.entries)
58- entry.key: FieldValue .increment (entry.value),
59-
60- // Account for this stat tracking operation as an additional write
61- // operation.
62- '$writesField /stats' : FieldValue .increment (1 ),
63- },
64- SetOptions (merge: true ),
65- );
48+ // TODO: call api endpoint.
6649 statBatch.clear ();
6750 },
6851 forceRunAfter: 20 ,
0 commit comments