test(7836): the client's link states are pinned to what a read returns
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,10 @@ _REMOVED_NOTE = "removed from the lesson's rules by an update"
|
||||
# of that answer's reason.
|
||||
_NO_RULE_NOTE = "no rule fits: "
|
||||
|
||||
# The link states a read returns, in the order it lists them: a judgment,
|
||||
# never a suggestion.
|
||||
READ_STATES = (CONFIRMED, REJECTED)
|
||||
|
||||
# What `rule_judgment` reads on a lesson payload — the three answers.
|
||||
LINKED, NO_RULE, UNJUDGED = "linked", "no_rule", "unjudged"
|
||||
|
||||
@@ -279,7 +283,7 @@ async def rules_for_lessons(user_id: int, lesson_ids) -> dict[int, list[dict]]:
|
||||
out: dict[int, list[dict]] = {i: [] for i in ids}
|
||||
if not ids:
|
||||
return out
|
||||
order = {CONFIRMED: 0, REJECTED: 1}
|
||||
order = {s: n for n, s in enumerate(READ_STATES)}
|
||||
async with async_session() as session:
|
||||
rows = (await session.execute(
|
||||
select(LessonRuleLink, Rule)
|
||||
@@ -306,7 +310,7 @@ async def lessons_for_rule(user_id: int, rule_id: int) -> list[dict]:
|
||||
"""
|
||||
from grimoire.services.access import readable_notes_clause
|
||||
|
||||
order = {CONFIRMED: 0, REJECTED: 1}
|
||||
order = {s: n for n, s in enumerate(READ_STATES)}
|
||||
async with async_session() as session:
|
||||
rows = (await session.execute(
|
||||
select(LessonRuleLink, Note)
|
||||
|
||||
@@ -20,7 +20,6 @@ import inspect
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from grimoire.models.lesson_rule_link import LINK_STATES
|
||||
from grimoire.services import lesson_rules as links_svc
|
||||
from grimoire.services.access import PERMISSION_RANK
|
||||
|
||||
@@ -48,8 +47,8 @@ def test_the_client_judgment_union_is_the_services_three_answers():
|
||||
}
|
||||
|
||||
|
||||
def test_the_client_link_states_are_the_models():
|
||||
assert _union(_read("api/lessons.ts"), "LinkState") == set(LINK_STATES)
|
||||
def test_the_client_link_states_are_the_ones_a_read_returns():
|
||||
assert _union(_read("api/lessons.ts"), "LinkState") == set(links_svc.READ_STATES)
|
||||
|
||||
|
||||
def test_the_lesson_page_answers_all_three_judgments():
|
||||
|
||||
Reference in New Issue
Block a user