Skip to content

Commit 8afe17f

Browse files
committed
v1.23: fix getAllPeriods - replace collectionGroup with per-citizen queries
1 parent 71f718f commit 8afe17f

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

index.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -986,12 +986,15 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
986986
return count;
987987
},
988988
async getAllPeriods(){
989-
const ledSnap=await fs.getDocs(fs.collectionGroup(db,"ledger"));
989+
const cSnap=await fs.getDocs(fs.collection(db,"citizens"));
990990
const periods=new Set();
991-
ledSnap.docs.forEach(d=>{
992-
const e=d.data();
993-
if(e.type==="charge" && e.note) periods.add(e.note);
994-
});
991+
for(const d of cSnap.docs){
992+
const ledSnap=await fs.getDocs(fs.collection(db,"citizens",d.id,"ledger"));
993+
ledSnap.docs.forEach(ld=>{
994+
const e=ld.data();
995+
if(e.type==="charge" && e.note) periods.add(e.note);
996+
});
997+
}
995998
return Array.from(periods).sort();
996999
},
9971000
async getExcludedPeriods(){

0 commit comments

Comments
 (0)