From e232f2b469750a1927ff586afd85fd5a66bd4bdb Mon Sep 17 00:00:00 2001 From: Alain Van Driessche Date: Thu, 7 Mar 2024 12:56:25 +0100 Subject: [PATCH] Fix Certificates of Excellences Generation --- app/CertificateExcellence.php | 5 ++--- app/Http/Controllers/ExcellenceController.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/CertificateExcellence.php b/app/CertificateExcellence.php index b2dd6c212..28aa78e9a 100644 --- a/app/CertificateExcellence.php +++ b/app/CertificateExcellence.php @@ -28,6 +28,7 @@ class CertificateExcellence public function __construct($edition, $name_for_certificate, $type, $number_of_activities) { + $this->edition = $edition; $this->name_of_certificate_holder = $name_for_certificate; $this->email_of_certificate_holder = auth()->user()->email ?? ''; @@ -35,8 +36,7 @@ public function __construct($edition, $name_for_certificate, $type, $number_of_a $this->resource_path = resource_path() . "/latex"; $this->pdflatex = config('codeweek.pdflatex_path'); $this->id = auth()->id() . '-' . str_random(10); - $this->number_of_activities = $number_of_activities; - $this->type = $type ?? "excellence"; + $this->type = $type; $this->templateName = "{$this->type}-{$this->edition}.tex"; @@ -139,7 +139,6 @@ protected function customize_and_save_latex() if ($this->type == "super-organiser") { $template = str_replace('', $this->tex_escape($this->email_of_certificate_holder), $template); $template = str_replace('', $this->tex_escape(Carbon::now()->format('d/m/Y')), $template); - $template = str_replace('', $this->tex_escape($this->number_of_activities), $template); } //save it locally diff --git a/app/Http/Controllers/ExcellenceController.php b/app/Http/Controllers/ExcellenceController.php index a1aedd901..7ac8e8886 100644 --- a/app/Http/Controllers/ExcellenceController.php +++ b/app/Http/Controllers/ExcellenceController.php @@ -49,7 +49,7 @@ public function generate($edition, Request $request) $name = $request["name_for_certificate"]; - $certificate_url = (new CertificateExcellence($edition, $name))->generate(); + $certificate_url = (new CertificateExcellence($edition, $name,'excellence',null))->generate(); ExcellenceQuery::byYear($edition) ->update([