개선관리 요구사항과 Google 로그인을 완료

This commit is contained in:
Yun Chan 2026-08-28 16:07:09 +09:00
parent cc0a15b7c6
commit 2a39636163
112 changed files with 10166 additions and 527 deletions

View file

@ -71,6 +71,14 @@ def _value(row: Mapping[str, Any], key: str, default: Any = None) -> Any:
return default
def _public_row(row: Mapping[str, Any]) -> dict[str, Any]:
"""API 응답에서 학습자 피드백 정책 판정 전용 열을 제거한다."""
payload = dict(row)
payload.pop("source_learner_feedback_enabled", None)
return payload
def _canonical_hash(payload: Mapping[str, Any]) -> str:
serialized = json.dumps(
payload,
@ -1544,10 +1552,17 @@ async def read_calibration_transfer(
histories = list(
await conn.fetch(
"""
SELECT history_id, session_id, competency_id, practice_block_id,
scenario_variant_id, phrase_family_id, created_at
FROM app.calibration_prediction_history
WHERE learner_id = $1 ORDER BY created_at, history_id
SELECT history.history_id, history.session_id,
history.competency_id, history.practice_block_id,
history.scenario_variant_id, history.phrase_family_id,
history.created_at,
source_session.learner_feedback_enabled
AS source_learner_feedback_enabled
FROM app.calibration_prediction_history history
JOIN app.sessions source_session
ON source_session.id = history.session_id
WHERE history.learner_id = $1
ORDER BY history.created_at, history.history_id
""",
target_learner_id,
)
@ -1615,10 +1630,13 @@ async def read_calibration_transfer(
a.source_observation_ids, a.assessment_payload,
a.model_run_id, a.instrument_id, a.instrument_version,
a.evidence_turn_ids, a.created_at,
p.prescription_id, p.prescription_payload
p.prescription_id, p.prescription_payload,
source_session.learner_feedback_enabled
AS source_learner_feedback_enabled
FROM app.calibration_assessment_snapshot a
JOIN app.calibration_metacognitive_prescription p
ON p.assessment_snapshot_id = a.assessment_snapshot_id
JOIN app.sessions source_session ON source_session.id = a.session_id
WHERE a.learner_id = $1
ORDER BY a.competency_id, a.snapshot_no
""",
@ -1628,12 +1646,18 @@ async def read_calibration_transfer(
suites = list(
await conn.fetch(
"""
SELECT transfer_suite_record_id, submission_id, suite_key,
session_id, training_phrase_family_ids, model_run_id,
instrument_id, instrument_version, data_classification,
clinical_claim_allowed, created_at
FROM app.calibration_transfer_suite
WHERE learner_id = $1 ORDER BY created_at, transfer_suite_record_id
SELECT suite.transfer_suite_record_id, suite.submission_id,
suite.suite_key, suite.session_id,
suite.training_phrase_family_ids, suite.model_run_id,
suite.instrument_id, suite.instrument_version,
suite.data_classification, suite.clinical_claim_allowed,
suite.created_at,
source_session.learner_feedback_enabled
AS source_learner_feedback_enabled
FROM app.calibration_transfer_suite suite
JOIN app.sessions source_session ON source_session.id = suite.session_id
WHERE suite.learner_id = $1
ORDER BY suite.created_at, suite.transfer_suite_record_id
""",
target_learner_id,
)
@ -1715,14 +1739,29 @@ async def read_calibration_transfer(
actual_event_rows = list(
await conn.fetch(
"""
SELECT *
FROM app.calibration_transfer_execution_event
WHERE learner_id = $1
ORDER BY competency_id, created_at, execution_event_id
SELECT execution.*,
practice_session.learner_feedback_enabled
AS source_learner_feedback_enabled
FROM app.calibration_transfer_execution_event execution
JOIN app.sessions practice_session
ON practice_session.id = execution.practice_session_id
WHERE execution.learner_id = $1
ORDER BY execution.competency_id, execution.created_at,
execution.execution_event_id
""",
target_learner_id,
)
)
learner_feedback_snapshot_enabled = all(
bool(
_value(
item,
"source_learner_feedback_enabled",
True,
)
)
for item in (*histories, *assessments, *suites, *actual_event_rows)
)
revisions_by_history: dict[UUID, list[dict[str, Any]]] = {}
for row in revisions:
@ -1737,7 +1776,7 @@ async def read_calibration_transfer(
}
prediction_histories: list[dict[str, Any]] = []
for row in histories:
item = dict(row)
item = _public_row(row)
history_id = UUID(str(_value(row, "history_id")))
item["revisions"] = revisions_by_history.get(history_id, [])
item["lock"] = locks_by_history.get(history_id)
@ -1760,7 +1799,7 @@ async def read_calibration_transfer(
).append(dict(row))
suite_payloads: list[dict[str, Any]] = []
for row in suites:
item = dict(row)
item = _public_row(row)
suite_id = UUID(str(_value(row, "transfer_suite_record_id")))
item["trials"] = trials_by_suite.get(suite_id, [])
item["assessments"] = assessments_by_suite.get(suite_id, [])
@ -1774,8 +1813,9 @@ async def read_calibration_transfer(
"learner_id": target_learner_id,
"requested_view": requested_view,
"clinical_claim_allowed": False,
"_learner_feedback_snapshot_enabled": learner_feedback_snapshot_enabled,
"prediction_histories": prediction_histories,
"calibration_assessments": [dict(item) for item in assessments],
"calibration_assessments": [_public_row(item) for item in assessments],
"transfer_suites": suite_payloads,
"teacher_reviews": [dict(item) for item in reviews],
"actual_executions": [