From 1ada360eb01f7351f2717f9e1c869f9e4f5632ac Mon Sep 17 00:00:00 2001 From: Thomas de Roo <2+thomas@noreply.localhost> Date: Mon, 15 Jun 2026 12:05:38 +0200 Subject: [PATCH] Update learn.php --- learn.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/learn.php b/learn.php index 5fc9932..94ff642 100644 --- a/learn.php +++ b/learn.php @@ -20,8 +20,24 @@ if (!$data) { die('Geen lijst'); } -// kies woord (simpel: random) -$word = $data['words'][array_rand($data['words'])]; +// kies woord +require_once 'includes/srs_queue.php'; + +$words = $data['words']; + +$words = sortDueWords($words); + +$today = date('Y-m-d'); + +$due = array_filter($words, function ($w) use ($today) { + return !isset($w['nextReview']) || $w['nextReview'] <= $today; +}); + +if (count($due) > 0) { + $word = array_values($due)[0]; +} else { + $word = $words[0]; +} ?>