fix(test-app): convert boolean pending to number in display
The pending field in NotificationStatus is a boolean, but the UI was displaying it directly, causing "true" to appear instead of a numeric count when notifications were scheduled. Added a pendingCount computed property that converts boolean values to numbers (true → 1, false → 0) while also handling number types for future compatibility.
This commit is contained in:
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="label">Pending Count:</span>
|
<span class="label">Pending Count:</span>
|
||||||
<span class="value">{{ notificationStatus.pending || 0 }}</span>
|
<span class="value">{{ pendingCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="notificationStatus.lastNotificationTime" class="info-row">
|
<div v-if="notificationStatus.lastNotificationTime" class="info-row">
|
||||||
@@ -289,6 +289,19 @@ class NotificationsView extends Vue {
|
|||||||
second: '2-digit'
|
second: '2-digit'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get pendingCount(): number {
|
||||||
|
if (!this.notificationStatus) return 0
|
||||||
|
const pending = this.notificationStatus.pending
|
||||||
|
// Handle both boolean and number types
|
||||||
|
if (typeof pending === 'boolean') {
|
||||||
|
return pending ? 1 : 0
|
||||||
|
}
|
||||||
|
if (typeof pending === 'number') {
|
||||||
|
return pending
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export default toNative(NotificationsView)
|
export default toNative(NotificationsView)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user