1
0
mirror of synced 2026-08-05 18:06:54 +00:00

FIX: add a fix for cases where ad record is not found (#214)

This commit is contained in:
Arpit Jalan
2024-07-05 13:00:18 +05:30
committed by GitHub
parent 9b72130fdf
commit ec53a0d6b8
@@ -76,8 +76,9 @@ export default AdComponent.extend({
const filteredAds = adNames.filter((adName) => {
const ad = houseAds.creatives[adName];
return (
!ad.category_ids?.length ||
ad.category_ids.includes(this.currentCategoryId)
ad &&
(!ad.category_ids?.length ||
ad.category_ids.includes(this.currentCategoryId))
);
});
if (filteredAds.length > 0) {
@@ -129,8 +130,9 @@ export default AdComponent.extend({
const filteredAds = adNames.filter((adName) => {
const ad = houseAds.creatives[adName];
return (
!ad.category_ids?.length ||
ad.category_ids.includes(this.currentCategoryId)
ad &&
(!ad.category_ids?.length ||
ad.category_ids.includes(this.currentCategoryId))
);
});
adIndex[placement] = Math.floor(Math.random() * filteredAds.length);