Skip to content

Commit

Permalink
issue 1197
Browse files Browse the repository at this point in the history
 - added method to check for previous data
   - show message if no previous data found
 - fixed spelling error in census table config household-type
  • Loading branch information
horatiorosa committed May 10, 2024
1 parent bbb9e73 commit d9f81bc
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 26 deletions.
14 changes: 13 additions & 1 deletion app/components/data-table-row-current.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default Component.extend({
tagName: 'tr',
classNameBindings: ['getClassNames'],

getClassNames: computed('rowConfig', 'isSelected', function() {
getClassNames: computed('rowConfig', 'isSelected', function () {
const rowConfig = this.get('rowConfig');
const classes = [];

Expand All @@ -31,6 +31,18 @@ export default Component.extend({
return classes.join(' ');
}),

noPriorData: computed('data.previous.sum', function () {
const { 'data.previous': previous } = this.getProperties('data.previous');
if (
(previous &&
(typeof previous.sum === 'undefined' || previous.sum === null)) ||
typeof previous === 'undefined'
) {
return true;
}
return false;
}),

actions: {
showData() {
window.logModel = this.get('data');
Expand Down
6 changes: 3 additions & 3 deletions app/table-config/census/household-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export default [
{ data: 'nfmhhu65', title: 'Householder under 65 years', indent: 1 },
{ data: 'nfmlvgaln', title: 'Householder living alone', indent: 1 },
{ data: 'nflva65pl', title: 'Householder 65 years and over', indent: 2 },
{ divider: true,},
{ divider: true },
{ data: 'hh_2', title: 'Total households', highlight: true },
{ data: 'mrdcplhh', title: 'Married couple household' },
{ data: 'mrdch18', title: 'With own children under 18', indent: 1 },
{ data: 'cocplhh', title: 'Cohabitng couple household' },
{ data: 'cocplhh', title: 'Cohabiting couple household' },
{ data: 'cocplch18', title: 'With own children under 18', indent: 1 },
{ data: 'malehhns', title: 'Male householder, no spouse or partner present' },
{ data: 'mnspchu18', title: 'With own children under 18', indent: 1 },
Expand All @@ -18,7 +18,7 @@ export default [
title: 'Female householder, no spouse or partner present',
},
{ data: 'fnspchu18', title: 'With own children under 18', indent: 1 },
{ divider: true,},
{ divider: true },
{ data: 'hhwu18', title: 'Households with individuals under 18 years' },
{ data: 'hhw65pl', title: 'Households with individuals 65 years and over' },
];
60 changes: 41 additions & 19 deletions app/templates/components/data-table-row-current.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#unless this.rowConfig.divider}}
{{#unless (or this.rowConfig.divider this.noPriorData)}}
<td class='title-column' {{action 'showData'}}>
<span>
{{this.rowConfig.title}}
Expand All @@ -19,7 +19,7 @@
class="cell-border-left no-compare-message"
colspan={{if this.reliability "5" "2"}}
>
Data are suppressed for selected area
Data for this row are not comparable or are unavailable
</td>
{{else}}
{{data-table-column-group
Expand Down Expand Up @@ -125,30 +125,52 @@
{{/if}}

{{else}}

<td>&nbsp;</td>
<td class="cell-border-left">&nbsp;</td>
<td>&nbsp;</td>
{{#if this.reliability}}
<td>&nbsp;</td>
<td>&nbsp;</td>
{{#if this.noPriorData}}
<td class='title-column' {{action 'showData' }}>
<span>
{{@rowConfig.title}}
{{#if @rowConfig.tooltip}}
{{fa-icon icon='question-circle' transform='shrink-2'}}
{{ember-tooltip text=@rowConfig.tooltip side='right'}}
{{/if}}
</span>
</td>
<td
class="cell-border-left no-compare-message"
colspan="2"
>
{{#unless (not this.rowConfig.data)}}
Data for this row are not comparable or are unavailable
{{else}}
&nbsp;
{{/unless}}
</td>
{{else}}
<td>&nbsp;</td>
<td class="cell-border-left">&nbsp;</td>
{{/if}}

<td class="cell-border-left">&nbsp;</td>
<td>&nbsp;</td>
{{#if this.reliability}}

<td>&nbsp;</td>
{{#if this.reliability}}
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
{{/if}}

<td class="cell-border-left">&nbsp;</td>
<td>&nbsp;</td>
{{#if this.reliability}}
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
{{/if}}

<td class="cell-border-left">&nbsp;</td>
<td>&nbsp;</td>
{{/if}}

<td class="cell-border-left">&nbsp;</td>
<td>&nbsp;</td>
{{#if this.reliability}}
{{#if this.reliability}}
<td>&nbsp;</td>
<td>&nbsp;</td>
{{/if}}
{{/if}}

{{/unless}}
{{yield}}
6 changes: 3 additions & 3 deletions app/templates/components/data-table-row-previous.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class="cell-border-left no-compare-message"
colspan={{if this.reliability "5" "2"}}
>
Data are suppressed for selected area
Data for this row are not comparable or are unavailable
</td>
{{else}}
{{data-table-column-group
Expand Down Expand Up @@ -140,9 +140,9 @@
class="cell-border-left no-compare-message"
>
{{#unless (not this.rowConfig.data)}}
Data for this row are not comparable or are unavailable
Data for this row are not comparable or are unavailable
{{else}}
&nbsp;
&nbsp;
{{/unless}}
</td>
{{else}}
Expand Down

0 comments on commit d9f81bc

Please sign in to comment.