52 lines
1.3 KiB
Markdown
52 lines
1.3 KiB
Markdown
# On This Day
|
|
|
|
## Route
|
|
|
|
- URL: `GET /discover/on-this-day`
|
|
- Controller: `App\Http\Controllers\Web\DiscoverController::onThisDay()`
|
|
|
|
## What the page reads
|
|
|
|
This page is a direct MySQL query over `artworks`.
|
|
It does not use Meilisearch.
|
|
|
|
## Query logic
|
|
|
|
The controller selects artworks that are:
|
|
|
|
- public
|
|
- published
|
|
- approved
|
|
- published on the same month/day as today
|
|
- from a previous year only
|
|
|
|
It then sorts them by `published_at DESC` and paginates 24 per page.
|
|
|
|
Equivalent logic:
|
|
|
|
```text
|
|
MONTH(published_at) = today.month
|
|
AND DAY(published_at) = today.day
|
|
AND YEAR(published_at) < today.year
|
|
```
|
|
|
|
## Data sources
|
|
|
|
- primary source: `artworks`
|
|
- supporting eager loads: `user`, `user.profile`, `categories`
|
|
|
|
## Cache behavior
|
|
|
|
- no explicit controller cache
|
|
|
|
## Background jobs and schedules
|
|
|
|
No dedicated cron drives this page.
|
|
|
|
It only depends on correct `published_at` values and the usual public/published scopes.
|
|
|
|
## Notes
|
|
|
|
- This is a calendar-history page, not a popularity or momentum page.
|
|
- The current implementation simply orders by newest qualifying `published_at`, not by views, downloads, or favourites.
|
|
- There are also legacy `TodayInHistoryController` variants elsewhere in the codebase, but `/discover/on-this-day` currently uses `DiscoverController::onThisDay()`. |