Skip to content

Commit

Permalink
attempts to fix latency
Browse files Browse the repository at this point in the history
  • Loading branch information
kmarshgov committed Feb 5, 2025
1 parent e00f6e1 commit 61c5f7f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Modules/Institution/App/Http/Controllers/AttestationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ public function index()

// Get the inst cap and check if we have hit the cap for issued attestations
// This is going to be all attes. under this inst. and are using the same fed cap as this.
$issued_attestations = Attestation::where('status', 'Issued')
->where('institution_guid', $cap->institution_guid)
->where('fed_cap_guid', $cap->fed_cap_guid)
->count();
// $issued_attestations = Attestation::where('status', 'Issued')
// ->where('institution_guid', $cap->institution_guid)
// ->where('fed_cap_guid', $cap->fed_cap_guid)
// ->count();

// If the attestation is linked to a reserved graduate program
// Get the total for reserved graduate issued attestations
$issued_res_grad_attestations = Attestation::where('status', 'Issued')
->where('institution_guid', $cap->institution_guid)
->where('fed_cap_guid', $cap->fed_cap_guid)
->whereHas('program', function ($query) {
$query->where('program_graduate', true);
})
->count();
// $issued_res_grad_attestations = Attestation::where('status', 'Issued')
// ->where('institution_guid', $cap->institution_guid)
// ->where('fed_cap_guid', $cap->fed_cap_guid)
// ->whereHas('program', function ($query) {
// $query->where('program_graduate', true);
// })
// ->count();

// Fetch issued attestations count **in a single query**
$issued_counts = Attestation::selectRaw("
Expand Down Expand Up @@ -116,7 +116,7 @@ public function index()
}

// Fetch countries with caching
$this->countries = Cache::remember('active_countries', 3600, function () {
$this->countries = Cache::remember('active_countries', now()->addHours(10), function () {
return Country::select('name')->where('active', true)->get();
});

Expand Down

0 comments on commit 61c5f7f

Please sign in to comment.