diff --git a/app/properties/page.js b/app/properties/page.js index b35660a..e6deee6 100644 --- a/app/properties/page.js +++ b/app/properties/page.js @@ -80,7 +80,7 @@ function mapApiProperty(item, index) { features, images, status, - rating: item.rating || 4.5, + rating: item.rating || 0, isNew: false, _raw: item, }; @@ -299,10 +299,12 @@ const PropertyCard = ({ property, viewMode = 'grid', onLoginRequired }) => { {property.area}م² + {property.rating > 0 && (
- - {property.rating || 4.5} + + {property.rating.toFixed(1)}
+ )} { - const info = p.propertyInformation || {}; - if (info.id) myPropIds.add(Number(info.id)); - if (p.id) myPropIds.add(Number(p.id)); - }); + const collectIds = (result) => { + if (result.status !== 'fulfilled' || !result.value) return; + const list = Array.isArray(result.value) ? result.value : [result.value]; + list.filter(Boolean).forEach(p => { + const info = p.propertyInformation || {}; + if (info.id) myPropIds.add(Number(info.id)); + if (p.id) myPropIds.add(Number(p.id)); + }); + }; + collectIds(myRent); + collectIds(mySale); const propInfoId = mapped._raw?.propertyInformation?.id; if (myPropIds.has(Number(mapped.id)) || (propInfoId && myPropIds.has(Number(propInfoId)))) { setIsOwnProperty(true);