Skip to content

Commit

Permalink
Fix Certificates of Excellences Generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alainvd committed Mar 7, 2024
1 parent 1161700 commit e232f2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/CertificateExcellence.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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 ?? '';
$this->personalized_template_name = $edition . "-" . auth()->id();
$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";

Expand Down Expand Up @@ -139,7 +139,6 @@ protected function customize_and_save_latex()
if ($this->type == "super-organiser") {
$template = str_replace('<CERTIFICATE_EMAIL>', $this->tex_escape($this->email_of_certificate_holder), $template);
$template = str_replace('<CERTIFICATE_DATE>', $this->tex_escape(Carbon::now()->format('d/m/Y')), $template);
$template = str_replace('<NUMBER_OF_ACTIVITIES>', $this->tex_escape($this->number_of_activities), $template);
}

//save it locally
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ExcellenceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit e232f2b

Please sign in to comment.