Changeset 13b2986 in Klonkt


Ignore:
Timestamp:
06/19/2026 08:20:35 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
977f65d
Parents:
59e522f
Message:

EPK: Music section = top 10 most played (instead of first 6 in order)

Query now orders by play_count DESC LIMIT 10; section is titled "Most played"
with a rank number per track.

Co-Authored-By: Claude <noreply@…>

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/routes/epk.js

    r59e522f r13b2986  
    2525  if (!site) return next();
    2626
     27  // Top 10 meest beluisterde nummers (op play_count), niet zomaar de eerste paar.
    2728  const tracks = db.prepare(
    28     `SELECT title, artist, duration, cover_url
     29    `SELECT title, artist, duration, cover_url, COALESCE(play_count, 0) AS plays
    2930       FROM audio_tracks
    3031      WHERE site_id = ?
    31       ORDER BY position ASC, created_at ASC
    32       LIMIT 6`
     32      ORDER BY plays DESC, position ASC, created_at ASC
     33      LIMIT 10`
    3334  ).all(site.id);
    3435
  • src/views/pages/epk.ejs

    r59e522f r13b2986  
    2828  <% if (epkTracks && epkTracks.length) { %>
    2929    <div class="epk-block">
    30       <h2 class="epk-h2">Muziek</h2>
     30      <h2 class="epk-h2">Meest beluisterd</h2>
    3131      <ul class="epk-tracks">
    32         <% epkTracks.forEach(function(t){ %>
     32        <% epkTracks.forEach(function(t, i){ %>
    3333          <li class="epk-track">
     34            <span class="epk-rank"><%= i + 1 %></span>
    3435            <% if (t.cover_url) { %><span class="epk-cover" style="background-image:url('<%= t.cover_url %>')"></span><% } else { %><span class="epk-cover epk-cover-empty">♪</span><% } %>
    3536            <span class="epk-track-meta">
     
    7778  .epk-tracks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
    7879  .epk-track { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid rgba(128,128,128,.18); border-radius: 12px; }
     80  .epk-rank { flex: 0 0 auto; width: 20px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; opacity: .45; }
    7981  .epk-cover { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 8px; background-size: cover; background-position: center; display: grid; place-items: center; }
    8082  .epk-cover-empty { background: var(--epk-accent); color: #fff; opacity: .85; }
Note: See TracChangeset for help on using the changeset viewer.