diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 48d59dcc4..976c51f1e 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -775,7 +775,6 @@ class Awards extends CI_Controller { public function rac() { $footerData = []; $footerData['scripts'] = [ - 'assets/js/sections/racmap_geojson.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/racmap_geojson.js")), 'assets/js/sections/racmap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/racmap.js")), 'assets/js/leaflet/L.Maidenhead.js', ]; @@ -838,7 +837,6 @@ class Awards extends CI_Controller { public function helvetia() { $footerData = []; $footerData['scripts'] = [ - 'assets/js/sections/helvetiamap_geojson.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/helvetiamap_geojson.js")), 'assets/js/sections/helvetiamap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/helvetiamap.js")), 'assets/js/leaflet/L.Maidenhead.js', ]; @@ -1369,7 +1367,6 @@ class Awards extends CI_Controller { public function wap() { $footerData = []; $footerData['scripts'] = [ - 'assets/js/sections/wapmap_geojson.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wapmap_geojson.js")), 'assets/js/sections/wapmap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wapmap.js")), 'assets/js/leaflet/L.Maidenhead.js', ]; @@ -1464,14 +1461,14 @@ class Awards extends CI_Controller { foreach ($wap_array as $was => $value) { foreach ($value as $key) { if($key != "") { - if (strpos($key, '>W<') !== false) { - $states[$was] = 'W'; - break; - } if (strpos($key, '>C<') !== false) { $states[$was] = 'C'; break; } + if (strpos($key, '>W<') !== false) { + $states[$was] = 'W'; + break; + } if (strpos($key, '-') !== false) { $states[$was] = '-'; break; diff --git a/application/models/Was.php b/application/models/Was.php index c840be292..7a868f6cd 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -36,15 +36,17 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
'; - $states[$line->col_state]['count']++; + $state = $this->normalizeState($line->col_state); // DC counts as MD + $bandWas[$state][$band] = ''; + $states[$state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; - $states[$line->col_state]['count']++; + $state = $this->normalizeState($line->col_state); // DC counts as MD + $bandWas[$state][$band] = ''; + $states[$state]['count']++; } } } @@ -112,7 +114,8 @@ class was extends CI_Model { function getSummaryByBand($band, $postdata, $location_list) { $bindings=[]; - $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; + // DC is combined with MD, so we use CASE to normalize + $sql = "SELECT count(distinct CASE WHEN thcv.col_state = 'DC' THEN 'MD' ELSE thcv.col_state END) as count FROM " . $this->config->item('table_name') . " thcv"; $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { @@ -148,7 +151,8 @@ class was extends CI_Model { function getSummaryByBandConfirmed($band, $postdata, $location_list) { $bindings=[]; - $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; + // DC is combined with MD, so we use CASE to normalize + $sql = "SELECT count(distinct CASE WHEN thcv.col_state = 'DC' THEN 'MD' ELSE thcv.col_state END) as count FROM " . $this->config->item('table_name') . " thcv"; $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { @@ -255,8 +259,16 @@ class was extends CI_Model { function addStateToQuery() { $sql = ''; $sql .= " and COL_DXCC in ('291', '6', '110')"; - $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; + // DC is combined with MD for WAS award + $sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DC','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')"; return $sql; } + + /** + * Normalize state code - DC counts as MD for WAS award + */ + function normalizeState($state) { + return ($state === 'DC') ? 'MD' : $state; + } } ?> diff --git a/application/views/awards/wap/index.php b/application/views/awards/wap/index.php index c8f3212a5..778dd73a2 100644 --- a/application/views/awards/wap/index.php +++ b/application/views/awards/wap/index.php @@ -1,5 +1,6 @@ diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index 70b1c1d50..b3496ee1c 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -2,6 +2,7 @@ var tileUrl="optionslib->get_option('option_map_tile_server');?>"; var lang_usa_state = "= _pgettext("USA State", "State"); ?>"; var lang_hover_over_a_state = "= __("Hover over a state"); ?>"; + var lang_inc = "= __("inc."); ?>";