Skip to content

Commit

Permalink
switch yearbuilt back to number instead of string, fix some commas too.
Browse files Browse the repository at this point in the history
  • Loading branch information
almccon committed Jan 9, 2017
1 parent fdad32e commit 03ebdd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/app/templates/building_comparison/table_body.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% _.each(metrics, function(metric){ %>
<td>
<div class="subheader"><span>average</span></div>
<div class="average-container" style="color: <%= metric.color %>"><span class="average"><%= metric.median.toLocaleString() %></span> <span class="unit"><%= metric.unit %></span></div>
<div class="average-container" style="color: <%= metric.color %>"><span class="average"><%= metric.isYear ? metric.median : metric.median.toLocaleString() %></span> <span class="unit"><%= metric.unit %></span></div>
</td>
<% }) %>
</tr>
Expand All @@ -21,7 +21,7 @@
<td class="metric <%= metric.undefined %>">
<div class="metric-container">
<div class="histogram"></div>
<span class="value" style="color: <%= metric.color %>"><%= (metric.value || "").toLocaleString() %></span>
<span class="value" style="color: <%= metric.color %>"><%= metric.isYear ? metric.value : (metric.value || "").toLocaleString() %></span>
<span class="no-value">N/A</span>
</div>
</td>
Expand Down
2 changes: 2 additions & 0 deletions src/app/views/building_comparison/building_comparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ define([
return {
value: value,
color: color,
isYear: (field == 'yearbuilt'), // TODO: don't hardcode this
undefined: (value ? 'defined' : 'undefined')
};
}, this);
Expand Down Expand Up @@ -75,6 +76,7 @@ define([

return _.extend({}, field, {
median: median,
isYear: (field.field_name == 'yearbuilt'), // TODO: don't hardcode this
color: gradientCalculator.toColor(median)
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/cities/seattle.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{"field": "primary_ptype_epa", "label": "Property Type: "},
{"field": "buildingtypename", "label": "Seattle Building Type: "},
{"field": "reported_gross_floor_area", "label": "Property Size (ft²): "},
{"field": "yearbuiltstring", "label": "Year Built: "},
{"field": "yearbuilt", "label": "Year Built: "},
{"field": "numbuildings", "label": "Number of Buildings: ", "suppress_unless_field": "primary_ptype_epa", "suppress_unless_value": "Multifamily Housing"},
{"field": "numfloors", "label": "Number of Floors: ", "suppress_unless_field": "primary_ptype_epa", "suppress_unless_value": "Multifamily Housing"},
{"field": "numunits", "label": "Number of Units: ", "suppress_unless_field": "primary_ptype_epa", "suppress_unless_value": "Multifamily Housing"},
Expand Down Expand Up @@ -75,7 +75,7 @@
},
{
"title": "Year Built",
"field_name": "yearbuiltstring",
"field_name": "yearbuilt",
"display_type": "range",
"range_slice_count": 18,
"color_range": ["#f0e5c7","#007749"],
Expand Down

0 comments on commit 03ebdd3

Please sign in to comment.