Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempts to fix latency #193

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading