From 70c7dc53e08368a131a19071f501d5e5faf81aff Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Sat, 12 Mar 2022 12:03:35 +0100 Subject: [PATCH 1/3] fix ldc web status checker --- app/Console/Commands/LDCWebStatusChecker.php | 2 +- config/ldcweb.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 config/ldcweb.php diff --git a/app/Console/Commands/LDCWebStatusChecker.php b/app/Console/Commands/LDCWebStatusChecker.php index fee2b72..f8a24f0 100644 --- a/app/Console/Commands/LDCWebStatusChecker.php +++ b/app/Console/Commands/LDCWebStatusChecker.php @@ -45,7 +45,7 @@ class LDCWebStatusChecker extends Command public function handle() { $data = []; - $data['uuid'] = env('PROJECT_UUID'); + $data['uuid'] = config('ldcweb.project_uuid'); // Sitemap.xml ? if (file_exists(public_path() . '/sitemap.xml')) { diff --git a/config/ldcweb.php b/config/ldcweb.php new file mode 100644 index 0000000..7c62d71 --- /dev/null +++ b/config/ldcweb.php @@ -0,0 +1,5 @@ + env('PROJECT_UUID') +]; From 8b3c3f31bea4881273e447ec0aefca2602e9ebd3 Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Sat, 12 Mar 2022 12:04:40 +0100 Subject: [PATCH 2/3] add nom to xml_incos null lst_allergenes --- app/Jobs/XmlIncoReader.php | 3 +- app/Models/XmlInco.php | 1 + ...3_12_115802_add_nom_to_xml_incos_table.php | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2022_03_12_115802_add_nom_to_xml_incos_table.php diff --git a/app/Jobs/XmlIncoReader.php b/app/Jobs/XmlIncoReader.php index 3a2998e..60080cc 100644 --- a/app/Jobs/XmlIncoReader.php +++ b/app/Jobs/XmlIncoReader.php @@ -61,6 +61,7 @@ class XmlIncoReader extends XmlJobs 'INCO_COMPO' => 'inco_compo', // Consider this sub array + 'INCO_COMPO.NOM' => 'nom', 'INCO_COMPO.TAILLE_REF' => 'taille_ref', 'INCO_COMPO.VAL_ENERG_KJ_NUT' => 'val_energ_kj_nut', 'INCO_COMPO.VAL_ENERG_KJ_R' => 'val_energ_kj_r', //_R apports de la taille_ref @@ -168,7 +169,7 @@ class XmlIncoReader extends XmlJobs 'allegations', 'astuces', 'arg_vente', 'pds_moy_theo', - 'lib_conso', 'lst_ing', + 'lib_conso', 'lst_ing', 'lst_allergene', 'allegat_sante', 'allegat_nutrit', 'allegat_autre', 'inco_compo', 'inco_compo.nom', diff --git a/app/Models/XmlInco.php b/app/Models/XmlInco.php index f33346b..c7b33cb 100644 --- a/app/Models/XmlInco.php +++ b/app/Models/XmlInco.php @@ -16,6 +16,7 @@ class XmlInco extends Model protected $fillable = [ 'id', 'no_art', + 'nom', 'prod_saison', 'allegations', 'conseil_prepa', diff --git a/database/migrations/2022_03_12_115802_add_nom_to_xml_incos_table.php b/database/migrations/2022_03_12_115802_add_nom_to_xml_incos_table.php new file mode 100644 index 0000000..120e12c --- /dev/null +++ b/database/migrations/2022_03_12_115802_add_nom_to_xml_incos_table.php @@ -0,0 +1,32 @@ +string('nom')->nullable()->after('id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('xml_incos', function (Blueprint $table) { + $table->dropColumn('nom'); + }); + } +} From 95fb67ed1334f31de90940518b66231f9190b96c Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Sat, 12 Mar 2022 12:05:00 +0100 Subject: [PATCH 3/3] re schedule tasks --- app/Console/Kernel.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 5614c3d..03faf99 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Jobs\XmlIncoReader as JobsXmlIncoReader; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -25,7 +26,8 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { $schedule->command('sitemap:refresh')->dailyAt('16:13'); - $schedule->command('ldcweb:statuschecker')->everySixHours(); + $schedule->command('ldcweb:statuschecker')->everyFifteenMinutes(); + $schedule->job(JobsXmlIncoReader::class)->name('xml-inco-reader')->onOneServer()->dailyAt('15:00'); //$schedule->job(new XmlIncoReader)->weeklyOn(1, '8:00'); }