mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 17:11:17 +00:00
fix: use TimeRelevance consts instead of strings
Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import type { Context, FeedEnhancement, FeedItem, FeedPostProcessor } from "@aris/core"
|
import type { Context, FeedEnhancement, FeedItem, FeedPostProcessor } from "@aris/core"
|
||||||
|
|
||||||
|
import { TimeRelevance } from "@aris/core"
|
||||||
|
|
||||||
import type { CalDavEventData } from "@aris/source-caldav"
|
import type { CalDavEventData } from "@aris/source-caldav"
|
||||||
import type { CalendarEventData } from "@aris/source-google-calendar"
|
import type { CalendarEventData } from "@aris/source-google-calendar"
|
||||||
import type { CurrentWeatherData } from "@aris/source-weatherkit"
|
import type { CurrentWeatherData } from "@aris/source-weatherkit"
|
||||||
@@ -304,7 +306,7 @@ function applyAfternoonWeekday(items: FeedItem[], boost: Record<string, number>)
|
|||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case CalendarFeedItemType.Event:
|
case CalendarFeedItemType.Event:
|
||||||
case CalDavFeedItemType.Event:
|
case CalDavFeedItemType.Event:
|
||||||
if (item.signals?.timeRelevance === "imminent") {
|
if (item.signals?.timeRelevance === TimeRelevance.Imminent) {
|
||||||
boost[item.id] = (boost[item.id] ?? 0) + 0.5
|
boost[item.id] = (boost[item.id] ?? 0) + 0.5
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@@ -342,7 +344,7 @@ function applyEveningWeekday(
|
|||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case CalendarFeedItemType.Event:
|
case CalendarFeedItemType.Event:
|
||||||
case CalDavFeedItemType.Event:
|
case CalDavFeedItemType.Event:
|
||||||
if (item.signals?.timeRelevance === "ambient") {
|
if (item.signals?.timeRelevance === TimeRelevance.Ambient) {
|
||||||
suppress.push(item.id)
|
suppress.push(item.id)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@@ -371,7 +373,7 @@ function applyEveningWeekend(
|
|||||||
break
|
break
|
||||||
case CalendarFeedItemType.Event:
|
case CalendarFeedItemType.Event:
|
||||||
case CalDavFeedItemType.Event:
|
case CalDavFeedItemType.Event:
|
||||||
if (item.signals?.timeRelevance === "ambient") {
|
if (item.signals?.timeRelevance === TimeRelevance.Ambient) {
|
||||||
suppress.push(item.id)
|
suppress.push(item.id)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@@ -385,7 +387,7 @@ function applyEveningWeekend(
|
|||||||
function applyNight(items: FeedItem[], boost: Record<string, number>, suppress: string[]): void {
|
function applyNight(items: FeedItem[], boost: Record<string, number>, suppress: string[]): void {
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
// Suppress all ambient items
|
// Suppress all ambient items
|
||||||
if (item.signals?.timeRelevance === "ambient") {
|
if (item.signals?.timeRelevance === TimeRelevance.Ambient) {
|
||||||
suppress.push(item.id)
|
suppress.push(item.id)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user