This commit is contained in:
@ -8,6 +8,7 @@
|
||||
* GET ?clientCode=X&answers=1 -> all completed questionnaire answers for one client (encrypted)
|
||||
* GET ?answersBulk=1 -> all assigned clients' answers in one payload (coach, encrypted)
|
||||
* GET ?scoringProfiles=1 -> active scoring profile definitions (encrypted)
|
||||
* GET ?sessions=1 -> active program session definitions with questionnaire assignments
|
||||
* GET ?scoringReview=1 -> coach review state (coachBand only; computed on device)
|
||||
* POST action=coachScoringReview -> coach agrees with or overrides calculated band (encrypted)
|
||||
* POST -> submit interview answers for a client (coach / supervisor / admin).
|
||||
@ -330,6 +331,10 @@ if ($method === 'POST') {
|
||||
|
||||
qdb_recompute_profile_scores_for_client($pdo, $clientCode, $qnID);
|
||||
|
||||
require_once __DIR__ . '/../lib/program_sessions.php';
|
||||
$cycleAdvanced = qdb_maybe_advance_program_cycle($pdo, $clientCode);
|
||||
$cycle = qdb_client_program_cycle_get($pdo, $clientCode);
|
||||
|
||||
$pdo->commit();
|
||||
qdb_save($tmpDb, $lockFp);
|
||||
|
||||
@ -338,6 +343,8 @@ if ($method === 'POST') {
|
||||
'sumPoints' => $sumPoints,
|
||||
'structureRevision' => $submitRev,
|
||||
'legacySubmit' => $isLegacySubmit,
|
||||
'cycleAdvanced' => $cycleAdvanced,
|
||||
'cycleNumber' => $cycle['cycleNumber'],
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
qdb_handler_fail($e, 'Submit questionnaire', $pdo ?? null, $tmpDb ?? null, $lockFp ?? null);
|
||||
@ -357,9 +364,17 @@ $fetchClients = $_GET['clients'] ?? '';
|
||||
$fetchAnswers = $_GET['answers'] ?? '';
|
||||
$fetchAnswersBulk = $_GET['answersBulk'] ?? '';
|
||||
$fetchScoringProfiles = $_GET['scoringProfiles'] ?? '';
|
||||
$fetchProgramSessions = $_GET['sessions'] ?? '';
|
||||
$fetchScoringReview = $_GET['scoringReview'] ?? '';
|
||||
$clientCode = trim($_GET['clientCode'] ?? '');
|
||||
|
||||
if ($fetchProgramSessions) {
|
||||
require_once __DIR__ . '/../lib/program_sessions.php';
|
||||
json_success(qdb_app_program_sessions_payload($pdo));
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($fetchScoringProfiles) {
|
||||
require_role(['coach'], $tokenRec);
|
||||
require_once __DIR__ . '/../lib/scoring.php';
|
||||
@ -468,10 +483,12 @@ if ($fetchClients) {
|
||||
}
|
||||
}
|
||||
|
||||
$clients = array_map(function ($code) use ($completions) {
|
||||
require_once __DIR__ . '/../lib/program_sessions.php';
|
||||
$clients = array_map(function ($code) use ($completions, $pdo) {
|
||||
return [
|
||||
'clientCode' => $code,
|
||||
'clientCode' => $code,
|
||||
'completedQuestionnaires' => $completions[$code] ?? [],
|
||||
'programProgress' => qdb_client_program_progress($pdo, $code),
|
||||
];
|
||||
}, $clientCodes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user