Skip to main content

attach_answer_data

Function attach_answer_data 

Source
pub async fn attach_answer_data(
    conn: &mut PgConnection,
    stored: &[StoredAnswer],
    file_store: &dyn FileStore,
    app_conf: &ApplicationConfiguration,
) -> ModelResult<HashMap<Uuid, AnswerData>>
Expand description

Resolves stored answers into AnswerData in one batch, minting a download URL per file.

Keyed by submission id. A submission is absent from the map only when its json answer has no data_json at all, which is the None its DTO carries. Only rows predating exercise_task_submissions_json_answer_has_data can be like that; the constraint is deliberately left unvalidated so they survive.