Skip to content

Commit

Permalink
Merge pull request #135 from nysenate/feature/nys-16117--schoolforms
Browse files Browse the repository at this point in the history
Fixed date filter on thanksiving and earth day submissions --TEMP FIX ONLY
  • Loading branch information
kzalewski authored Feb 15, 2024
2 parents c954fdb + c7df6c2 commit db3e36f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,30 @@ public function build() {
$form_type = $term->getName();
$senator_term = ($node->hasField('field_senator_multiref') && !$node->get('field_senator_multiref')->isEmpty()) ? $node->get('field_senator_multiref')->entity : [];

$last_year_params = $params = [
'form_type' => $form_type,
'senator' => $senator_term->id(),
'school' => NULL,
'teacher_name' => NULL,
'from_date' => strtotime('this year January 1st'),
'to_date' => NULL,
'sort_by' => NULL,
'sort_order' => NULL,
];
if ($form_type == 'Thankful') {
$last_year_params = $params = [
'form_type' => $form_type,
'senator' => $senator_term->id(),
'school' => NULL,
'teacher_name' => NULL,
'from_date' => strtotime('September 1, 2023'),
'to_date' => strtotime('December 31, 2023'),
'sort_by' => NULL,
'sort_order' => NULL,
];
}
elseif ($form_type == 'Earth Day') {
$last_year_params = $params = [
'form_type' => $form_type,
'senator' => $senator_term->id(),
'school' => NULL,
'teacher_name' => NULL,
'from_date' => strtotime('January 1, 2023'),
'to_date' => strtotime('December 31, 2023'),
'sort_by' => NULL,
'sort_order' => NULL,
];
}

$last_year_params['from_date'] = NULL;
$last_year_params['to_date'] = strtotime('last year December 31st');
Expand Down Expand Up @@ -154,7 +168,7 @@ public function build() {
'panels' => [
[
'tab_text' => 'Current Year',
'title' => date('Y') . ' Poster Submissions',
'title' => '2023 Poster Submissions',
'filter' => $filter,
'years' => $this->schoolFormsService->getResults($params, FALSE),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
'use strict';
Drupal.behaviors.nysenateHeader = {
attach: function (context) {
// If admin toolbar is present, abort and use static nav bar.
//if ($('#toolbar-administration').length > 0) {
// return;
//}

let self = this;
let userScroll = 0;
let currentTop = $(window).scrollTop();
Expand Down

0 comments on commit db3e36f

Please sign in to comment.