Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 1, 2024
1 parent fe39c58 commit dc4cd12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions app/Services/RecordService.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,16 @@ public static function getPart(string $code): Part

public static function isIndependentCandidate(string $name): bool
{
return Str::startsWith($name, config('import.independent_candidate_prefix'));
return Str::contains($name, config('import.independent_candidate_designation'), ignoreCase: true);
}

public static function getName(string $name): string
{
return Str::afterLast($name, config('import.independent_candidate_prefix'));
return Str::of($name)
->remove(config('import.independent_candidate_designation'), caseSensitive: false)
->trim('-')
->trim()
->value();
}

public static function generateVotables(array $header, int $electionId): Collection
Expand All @@ -86,7 +90,7 @@ public static function generateVotables(array $header, int $electionId): Collect
->where('election_id', $electionId)
->firstOr(
fn () => Candidate::query()
->where('name', $name)
->where('name', static::getName($name))
->where('election_id', $electionId)
->first()
);
Expand Down
2 changes: 1 addition & 1 deletion config/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'disk' => env('IMPORT_DISK', env('FILESYSTEM_DISK', 'local')),

'independent_candidate_prefix' => env('IMPORT_INDEPENDENT_CANDIDATE_PREFIX', 'CANDIDAT INDEPENDENT - '),
'independent_candidate_designation' => env('IMPORT_INDEPENDENT_CANDIDATE_DESIGNATION', 'CANDIDAT INDEPENDENT'),
'candidate_votes_suffix' => env('IMPORT_CANDIDATE_VOTES_SUFFIX', '-voturi'),

];
2 changes: 1 addition & 1 deletion resources/views/livewire/pages/election-results.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<section class="contents">
<x-election.title
:title="__('app.navigation.results')"
:title="__('app.navigation.results') . ' / Parțiale'"
:embed-url="$this->getEmbedUrl()"
:level="$level"
:country="$country"
Expand Down

0 comments on commit dc4cd12

Please sign in to comment.