vault backup: 2023-11-06 14:33:05

This commit is contained in:
Paul Trowbridge 2023-11-06 14:33:06 -05:00
parent 77c7162ecd
commit 48e3e2691e

21
api.ts
View File

@ -45,16 +45,19 @@ function apply_guidance(doc: any) {
function assignRelevanceIndicator(items, channelFirstChar, v1ds, v0ds) {
for (let item of items) {
// Check if the first character of the item's channel matches the first character of the document's channel
let relevance = (item.chan === channelFirstChar) ? 'relevant' : 'not relevant';
// Initialize relevance as numeric value
let relevance = 0; // Assume 0 is 'not relevant'
// Further refine relevance based on v1ds and v0ds
if (v1ds === item.v1ds && relevance === 'relevant') {
relevance = 'most relevant'; // v1ds is more relevant than v0ds
} else if (v0ds === item.v0ds && relevance === 'relevant') {
relevance = 'relevant'; // v0ds is relevant but less so than v1ds
} else {
relevance = 'not relevant'; // Neither v1ds nor v0ds
// Check if the first character of the item's channel matches the first character of the document's channel
if (item.chan === channelFirstChar) {
relevance = 1; // 'relevant'
// Further refine relevance based on v1ds and v0ds
if (v1ds === item.v1ds && relevance === 1) {
relevance = 2; // 'most relevant' because v1ds matches
} else if (v0ds === item.v0ds && relevance === 1) {
// Keep relevance as 1 because v0ds matches but is less relevant than v1ds
}
}
// Assign the calculated relevance to the item