Skip to content

Conversation

@WillShaw1100
Copy link
Contributor

@WillShaw1100 WillShaw1100 commented Dec 7, 2025

Summary of changes

Adds very basic widgets showing exam details for both practical and theory exams.

Screenshots (if necessary)

image image

$failed = PracticalResult::where('result', PracticalResult::FAILED)->count();
$incomplete = PracticalResult::where('result', PracticalResult::INCOMPLETE)->count();

$examStats = PracticalResult::select('exam', 'result', DB::raw('count(*) as total'))
Copy link
Contributor

@kristiankunc kristiankunc Dec 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what @AxonC thinks, but I feel like this query will eat us in prod. Thinking about some pagination such as quarterly/yearly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did cross my mind....
What if we tried to combine it?
Id be interested to know how the CTS shows these stats.


$cards = [
Stat::make('Total Taken', $overall->total),
Stat::make('Pass Rate', ($overall->total ? round($overall->passed / $overall->total * 100) : 100).'%')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

gotcha with an empty DB edge case 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was aware but decided it didn't really make a difference. Happy to correct to 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah it's fine, you can leave it. The DB should rarely be empty in prod

@kristiankunc
Copy link
Contributor

I assume you did this to show current year only.
We can default to that yes, but maybe something like https://github.com/VATSIM-UK/core/blob/main/app/Filament/Admin/Pages/Operations/GenerateQuarterlyStats.php could be added to display previous years. Not sure how useful it actually would be but if we're already adding the stats, we should cover the whole history we got imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants