From 906b8cdb2bd966783da77c25d3e484ad85018415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Krei=C3=9Fel?= Date: Fri, 29 Sep 2023 22:08:30 +0200 Subject: [PATCH 1/2] feat: include last opened in chaos --- src/scorer/feature/chaosFeatureScorer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scorer/feature/chaosFeatureScorer.ts b/src/scorer/feature/chaosFeatureScorer.ts index 488f0ca..2bb6a0e 100644 --- a/src/scorer/feature/chaosFeatureScorer.ts +++ b/src/scorer/feature/chaosFeatureScorer.ts @@ -1,6 +1,7 @@ import FeatureScorer from '../FeatureScorer' import { StatusType, accFeatureType } from '../../types' import { mastodon } from 'masto' +import Storage from '../../Storage' export default class chaosFeatureScorer extends FeatureScorer { constructor() { @@ -13,6 +14,8 @@ export default class chaosFeatureScorer extends FeatureScorer { } async score(api: mastodon.rest.Client, status: StatusType) { if (status.topPost) return 0 + const lastOpened = await Storage.getLastOpened() || 0 + const percent = (Date.now() - lastOpened) < (1000 * 60 * 60 * 6) ? 0.5 : 0.9 return Math.random() > 0.9 ? 1 : 0 } } \ No newline at end of file From 155063fafee043d45b3ad37a70d73e833462140a Mon Sep 17 00:00:00 2001 From: pkreissel Date: Fri, 29 Sep 2023 20:09:45 +0000 Subject: [PATCH 2/2] Build: 918718711071bdbadffc0659664420fb700999a6 --- dist/scorer/feature/chaosFeatureScorer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dist/scorer/feature/chaosFeatureScorer.js b/dist/scorer/feature/chaosFeatureScorer.js index 067b4d2..224be80 100644 --- a/dist/scorer/feature/chaosFeatureScorer.js +++ b/dist/scorer/feature/chaosFeatureScorer.js @@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const FeatureScorer_1 = __importDefault(require("../FeatureScorer")); +const Storage_1 = __importDefault(require("../../Storage")); class chaosFeatureScorer extends FeatureScorer_1.default { constructor() { super({ @@ -14,6 +15,10 @@ class chaosFeatureScorer extends FeatureScorer_1.default { }); } async score(api, status) { + if (status.topPost) + return 0; + const lastOpened = await Storage_1.default.getLastOpened() || 0; + const percent = (Date.now() - lastOpened) < (1000 * 60 * 60 * 6) ? 0.5 : 0.9; return Math.random() > 0.9 ? 1 : 0; } }