Commit 6ce03859 by Adarsh K

shopper service

parent 3d4110d8
......@@ -70,19 +70,18 @@ export class ShoppersService {
const This = this;
const state = true;
this.shoppers = [];
const itemsFound = {};
console.log(this.shoppers);
const catRef = this.afs.collection('shopcategories').doc(catId).get().subscribe((data) => {
this.shoppers = [];
console.log(data.data());
const shoppeerList = [];
const shoppers = data.data();
if (shoppers && Object.keys(shoppers).length > 0) {
Object.keys(shoppers)
.forEach(function eachKey(key) {
shoppeerList.push(key);
});
console.log(shoppeerList);
if (shoppeerList.length > 0) {
......@@ -96,7 +95,6 @@ export class ShoppersService {
} else {
break;
}
}
console.log(shopItems);
const orderRef: AngularFirestoreCollection<any> = this.afs.collection(
......@@ -108,6 +106,7 @@ export class ShoppersService {
orderRef.valueChanges().subscribe(value => {
console.log(value);
const res = value;
if (res.length > 0) {
res.forEach(item => {
......@@ -131,9 +130,12 @@ export class ShoppersService {
rate: item.rate,
centerId: item.centerId
};
if (!itemsFound[shopper.uid]) {
this.shoppers.push(shopper);
itemsFound[shopper.uid] = true;
}
});
// console.log(this.shoppers);
} else {
// alert('No Orders Found');
}
......@@ -141,7 +143,6 @@ export class ShoppersService {
}
}
} else {
console.log(this.shoppers);
this.shoppers = [];
this.shoppers.length = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment