diff options
-rw-r--r-- | lib/deck/mvent.php | 4 | ||||
-rw-r--r-- | lib/study/deck.php | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/deck/mvent.php b/lib/deck/mvent.php index 10d585a..28a7fa3 100644 --- a/lib/deck/mvent.php +++ b/lib/deck/mvent.php @@ -23,8 +23,8 @@ if ($pos > $mn) { $error = "A position is at least one..."; } else { sql("UPDATE cards SET number = 0 WHERE id = $cardid"); - sql("UPDATE cards SET number = number - 1 WHERE number > " . $card['number']); - sql("UPDATE cards SET number = number + 1 WHERE number >= $pos"); + sql("UPDATE cards SET number = number - 1 WHERE number > " . $card['number'] . " AND deck = $deckid ORDER BY number ASC"); + sql("UPDATE cards SET number = number + 1 WHERE number >= $pos AND deck = $deckid ORDER BY number DESC"); sql("UPDATE cards SET number = $pos WHERE id = $cardid"); sql("UPDATE deck_study SET need_check = 1 WHERE deck = $deckid"); header("Location: view-deck-$deckid"); diff --git a/lib/study/deck.php b/lib/study/deck.php index 9b9c71f..94790e3 100644 --- a/lib/study/deck.php +++ b/lib/study/deck.php @@ -80,7 +80,7 @@ $s = sql( "SELECT cards.id AS id, cards.name AS name, cards.text_html AS text, cards.number AS number, ". "card_study.level AS level, card_study.next_review <= CURDATE() AS must_study ". "FROM card_study LEFT JOIN cards ON card_study.card = cards.id WHERE deck_study = $studyid AND " . get_filter("what") . - " ORDER BY " . get_filter("order") . " " . get_filter('way')); + " ORDER BY " . get_filter("order") . " " . get_filter('way') . (get_filter("order") == "level" ? ", number " . get_filter("way") : "")); while ($ss = mysql_fetch_assoc($s)) $study_cards[] = $ss; |