MCPcopy Create free account
hub / github.com/dailydotdev/apps / getScoreBreakdown

Function getScoreBreakdown

packages/shared/src/features/feedExplain/describe.ts:484–600  ·  view source on GitHub ↗
(
  explain: RankedExplain,
)

Source from the content-addressed store, hash-verified

482 * first, and most cards end up below 1.
483 */
484export const getScoreBreakdown = (
485 explain: RankedExplain,
486): ScoreBreakdownParts => {
487 const { score, base, match, follow, age, seen, slot, explore } = explain;
488 const cautious = base.optimism && base.cautious;
489 const multipliers: ScoreFactor[] = [
490 {
491 label: 'Engagement',
492 hint: "How much readers clicked, upvoted, and commented on this post compared with a typical post. Until a post has much of that, its source's past posts count too.",
493 multiplier: cautious || base.value,
494 },
495 ...(cautious
496 ? [
497 {
498 label: 'New post',
499 hint: "New posts haven't had time to collect clicks and upvotes, so they get a lift toward how well they could do. The lift fades as the post gets older.",
500 multiplier: base.value / cautious,
501 },
502 ]
503 : []),
504 {
505 label: 'Topic match',
506 hint: 'How close the post is to the topics you follow and read.',
507 multiplier: match?.factor ?? 1,
508 },
509 {
510 label: 'Follow',
511 hint: 'A boost when you follow its source, squad, or author, with the level you set on them.',
512 multiplier: follow.factor,
513 },
514 {
515 label: 'Freshness',
516 hint: 'Newer posts score higher, and older ones slowly fade.',
517 multiplier: age.factor,
518 },
519 {
520 label: 'Seen before',
521 hint: seen.passive_shows
522 ? "Moves the post down if it was already in your feed, including times it loaded in a tab you didn't look at."
523 : "Moves the post down if you've already seen it in your feed.",
524 multiplier: seen.factor,
525 },
526 ...(explore
527 ? [
528 {
529 label: 'Random nudge',
530 hint: 'A small random change to the score, so your feed sometimes shows a post it would otherwise rank just below.',
531 multiplier: explore,
532 },
533 ]
534 : []),
535 ...(slot
536 ? [
537 {
538 label: "Topic's turn",
539 hint: "A boost when a topic you like hasn't been in your feed for a while.",
540 multiplier: slot.waiting,
541 },

Callers 2

describe.spec.tsFile · 0.90
FeedExplanationModalFunction · 0.90

Calls 1

hasEffectFunction · 0.85

Tested by

no test coverage detected