Skip to main content
Internal Service β€” This is not an HTTP endpoint. It’s called by the ranking-score route.

Purpose

Checks if a URL already has a score in the database. If yes, returns it. If no, generates a new score (32-49) and saves it.

Function Signature

Parameters

Returns

int - The ranking score (32-49 for new URLs, or existing stored score)

Logic Flow

Why 32-49?

The score range is intentionally low to:
  1. Show visitors they have β€œroom to improve”
  2. Create urgency to sign up
  3. Leave headroom for competitor scores (which are always higher)

Code

Error Handling

On database errors, falls back to generating a random score without saving. This ensures the endpoint always returns a response.