Commit 35e12ea1 authored by Rafael Chaves Freitas's avatar Rafael Chaves Freitas

melhora consolidador

parent db28cd3d
Pipeline #10025 passed with stages
in 1 minute and 36 seconds
......@@ -36,6 +36,31 @@ class Plugin extends \MapasCulturais\Plugin {
$conn = $app->em->getConnection();
$queries = [
"UPDATE registration
SET consolidated_result = '10'
WHERE
opportunity_id = :opportunity_id AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '10')",
"UPDATE registration
SET consolidated_result = '8'
WHERE
opportunity_id = :opportunity_id AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '8')",
"UPDATE registration
SET consolidated_result = '3'
WHERE
opportunity_id = :opportunity_id AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '3')",
"UPDATE registration
SET consolidated_result = '2'
WHERE
opportunity_id = :opportunity_id AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '2')",
"UPDATE registration
SET consolidated_result = 'homologado'
WHERE
......@@ -100,30 +125,6 @@ class Plugin extends \MapasCulturais\Plugin {
-- foi validado pelo dataprev
id IN (SELECT registration_id FROM registration_evaluation WHERE user_id = :user_id AND result = '10')",
"UPDATE registration
SET consolidated_result = '10'
WHERE
consolidated_result IS NULL AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '10')",
"UPDATE registration
SET consolidated_result = '8'
WHERE
consolidated_result IS NULL AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '8')",
"UPDATE registration
SET consolidated_result = '3'
WHERE
consolidated_result IS NULL AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '3')",
"UPDATE registration
SET consolidated_result = '2'
WHERE
consolidated_result IS NULL AND
id IN (SELECT registration_id FROM registration_evaluation WHERE status = 1 AND result = '2')"
];
foreach ($queries as $sql) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment