From a126d86bea99ed45b064d7ca47a6f005cd91f6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Mon, 28 Oct 2024 15:12:18 +0000 Subject: [PATCH] fix: vulnerabilities --- app/Reports/Queries/Pregnant/P03.php | 4 +- database/data/241028-vulnerabilities.xlsx | Bin 0 -> 7037 bytes ..._valid_column_in_vulnerabilities_table.php | 27 ++++++++ ...24_10_28_132539_update_vulnerabilities.php | 60 ++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 database/data/241028-vulnerabilities.xlsx create mode 100644 database/migrations/2024_10_28_132416_update_is_valid_column_in_vulnerabilities_table.php create mode 100644 database/migrations/2024_10_28_132539_update_vulnerabilities.php diff --git a/app/Reports/Queries/Pregnant/P03.php b/app/Reports/Queries/Pregnant/P03.php index e4de2776..37d90e7b 100644 --- a/app/Reports/Queries/Pregnant/P03.php +++ b/app/Reports/Queries/Pregnant/P03.php @@ -13,7 +13,7 @@ class P03 extends ReportQuery { /** - * Sum beneficiari with Gravidă adultă (VGR_04) OR Minoră gravidă (VGR_01); Femeie însărcinată care a efectuat consultaţii prenatale (VGR_98). + * Sum beneficiari with Gravidă adultă (VGR_04) OR Minoră gravidă (VGR_01); Femeie însărcinată care a efectuat consultaţii prenatale (VGR_96). */ public static function query(): Builder { @@ -22,7 +22,7 @@ public static function query(): Builder $query->whereJsonOverlaps('properties', ['VGR_04', 'VGR_01']); }) ->whereHasCatagraphyRelation(Catagraphy::class, function (QueryBuilder $query) { - $query->whereJsonContains('properties->attributes->cat_preg', 'VGR_98'); + $query->whereJsonContains('properties->attributes->cat_preg', 'VGR_96'); }); } } diff --git a/database/data/241028-vulnerabilities.xlsx b/database/data/241028-vulnerabilities.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c53d55ea6bdfcffbe1965064e9c24aa230ca8b75 GIT binary patch literal 7037 zcmaJ`1z1#D*QSPU7(hZmx`s{(=?0~{k?sbOMrmoJ8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g?%)?YWS zsJLrAZq;t_!E)eb9mer)x(UoEEp?Bfn#M#EvsEAX(<;x$ZX7EJX3idOOTlKdbo?ys z$`Sk4_9&Pkwy?uTL0q&n>KRz}bqm}lNf}SUuvsnOE`qL?jOX~LaB}U1_S5(Vew8Bo z49qW@I_8QAm0ub)I3C!OjS_~5M2}#-d*zXCZP(TdZ;ighGeXB$JkecMHhCJm{LBkn zEpJ19z@+sQ+L^+_;luoIavcgkbX=Br zdR*O%6T1Ds^ThwBc12TPk1I7DsM=4``qu>iJA&OP_*^UeBC&s|U9amljs4G!pqJb~ z)ow`bn~7cboolean('is_valid') + ->virtualAs(<<<'SQL' + CASE + WHEN id LIKE '%\\_9_' THEN 0 + ELSE 1 + END + SQL) + ->change(); + }); + } +}; diff --git a/database/migrations/2024_10_28_132539_update_vulnerabilities.php b/database/migrations/2024_10_28_132539_update_vulnerabilities.php new file mode 100644 index 00000000..ad6af2d0 --- /dev/null +++ b/database/migrations/2024_10_28_132539_update_vulnerabilities.php @@ -0,0 +1,60 @@ + $preg === 'VGR_98' ? 'VGR_96' : $preg; + + // Catagraphy + // updated_at >= 2024-10-24 00:00:00 + // cat_preg VGR_98 => VGR_96 + Catagraphy::query() + ->whereDate('updated_at', '>=', $cutoffDate) + ->whereJsonContains('cat_preg', 'VGR_98') + ->get() + ->each(function (Catagraphy $catagraphy) use ($callback) { + $catagraphy->timestamps = false; + + $catagraphy->updateQuietly([ + 'cat_preg' => collect($catagraphy->cat_preg) + ->map($callback) + ->all(), + ]); + }); + + // Activity log `vulnerabilities` + // created_at >= 2024-10-24 00:00:00 + // VGR_98 => VGR_96 + Activity::query() + ->where('created_at', '>=', $cutoffDate) + ->where('log_name', 'vulnerabilities') + ->whereJsonContains('properties', 'VGR_98') + ->get() + ->each(function (Activity $activity) use ($callback) { + $activity->timestamps = false; + + $activity->updateQuietly([ + 'properties' => $activity->properties + ->map($callback) + ->all(), + ]); + }); + } +};