fix financial and certificates

This commit is contained in:
root
2026-06-05 01:51:08 -04:00
parent d28d11e2e5
commit ad968eaff7
94 changed files with 9654 additions and 214 deletions
@@ -0,0 +1,36 @@
<?php
namespace App\Services\Grading\Policy;
use App\Models\Configuration;
class GradingPolicyResolver
{
public const LEGACY_MODE = 'legacy';
public const STRONG_MODE = 'strong';
public const LEGACY_VERSION = 'legacy_v1';
public const STRONG_VERSION = 'strong_v1';
public function calculationMode(?int $classSectionId = null, ?string $semester = null, ?string $schoolYear = null): string
{
$enabled = strtolower((string) (Configuration::getConfig('strong_grading_enabled') ?? ''));
if (!in_array($enabled, ['1', 'true', 'yes', 'on'], true)) {
return self::LEGACY_MODE;
}
$allowedSections = trim((string) (Configuration::getConfig('strong_grading_class_sections') ?? ''));
if ($allowedSections === '' || $allowedSections === '*') {
return self::STRONG_MODE;
}
$ids = array_filter(array_map('trim', explode(',', $allowedSections)), fn ($v) => $v !== '');
return $classSectionId !== null && in_array((string) $classSectionId, $ids, true)
? self::STRONG_MODE
: self::LEGACY_MODE;
}
public function policyVersion(string $mode): string
{
return $mode === self::STRONG_MODE ? self::STRONG_VERSION : self::LEGACY_VERSION;
}
}