Skip to content

Commit

Permalink
Merge pull request #209 from bcgov/jp-0001
Browse files Browse the repository at this point in the history
S40(09) DEV - Daily Campaign Update - Part 2 (24th -- s41(17) Challenge page historical ordering)
  • Loading branch information
jp-Telus authored Jun 12, 2023
2 parents 6709f32 + 47b21c6 commit 2d0adcc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/Http/Controllers/ChallengeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function index(Request $request) {
) * 100) - COALESCE((select participation_rate from historical_challenge_pages where year = ?
-- and historical_challenge_pages.organization_name = A.organization_name
and historical_challenge_pages.business_unit_code = A.business_unit_code
),0) desc
),0)
SQL;

Expand All @@ -147,7 +147,7 @@ public function index(Request $request) {
and D1.as_of_date <= ?
)
and eligible_employee_count >= 5
order by participation_rate desc, abs(change_rate) desc;
order by participation_rate desc, abs(change_rate);
SQL;

$challenges = DB::select($sql, $parameters);
Expand All @@ -170,7 +170,7 @@ public function index(Request $request) {
from historical_challenge_pages, (SELECT @row_number:=0) AS temp
where year = ?
and donors >= 5
order by participation_rate desc, abs(`change`) desc;
order by participation_rate desc, abs(`change`);
SQL;

$challenges = DB::select($sql, $parameters);
Expand Down
16 changes: 6 additions & 10 deletions resources/views/challenge/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
@php
function ordinal($number) {
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
if ((($number % 100) >= 11) && (($number%100) <= 13))
return $number. 'th';
else
return $number. $ends[$number % 10];
}
@endphp
@extends('adminlte::page')

@section('content_header')
<div class="mt-3">
<h1>Challenge</h1>
Expand All @@ -26,8 +18,8 @@ function ordinal($number) {
If you have questions about PECSF statistics, send us an e-mail at <a href="mailto:[email protected]?subject=Challenge%20page">[email protected]</a>.</h6>
</div>
@endsection
@section('content')

@section('content')

<div class="card">
<div class="card-body">
Expand Down Expand Up @@ -216,6 +208,10 @@ function addCommas(nStr)
serverSide: true,
select: true,
paging: false,
"initComplete": function(settings, json) {
min_height = $(".wrapper").height();
$(".main-sidebar").css('min-height', min_height);
},
ajax: {
url: '{!! route('challenge.index') !!}',
data: function (data) {
Expand Down

0 comments on commit 2d0adcc

Please sign in to comment.