From 78b4859947ffde9337fc96520d58b4cecf6188f6 Mon Sep 17 00:00:00 2001 From: Thomas de Roo <2+thomas@noreply.localhost> Date: Mon, 15 Jun 2026 12:21:20 +0200 Subject: [PATCH] Update api/next.php --- api/next.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/api/next.php b/api/next.php index bb159db..4067fd6 100644 --- a/api/next.php +++ b/api/next.php @@ -1,30 +1,29 @@ 'no_list']); +if (!isset($data['words']) || !is_array($data['words'])) { + echo json_encode(['error' => 'list_not_found']); exit; } -$words = sortDueWords($data['words']); +$words = $data['words']; $today = date('Y-m-d'); @@ -36,7 +35,10 @@ if (count($due) === 0) { $due = $words; } -$word = array_values($due)[0]; +// pak altijd eerste uit gesorteerde set (stabiel gedrag) +$due = array_values($due); + +$word = $due[0]; echo json_encode([ 'word' => $word