Code4HR/open-health-inspection-app

Float rounding on scores

Closed this issue · 5 comments

qwo commented

List view shows non-rounded floats on scores.

screenshot 2016-10-03 12 43 21

Requirements

  • Javascript Angular 1.3+

Steps to reproduce

  1. go to ohi.code4hr.org
  2. Query for ZIP "23510" and query for restaurant "brick" see below.

Steps to verify

  • The above reproduction shows the correct rounded value 96 and if it was 96.6 `97.
  • Verify the list view for addresses where the company has not had any reports yet marked as N/A still display.

I remember this being really hard to figure out for some reason in 2014!

qwo commented

haha ill try and tackle this if its just not a .toPrecision thing.

Rounding to the nearest whole number under is fine. I don't think we have two-digit floats anywhere else in the app.

qwo commented

ahh attempted to substitute
{{restaurant.score ? (restaurant.score | number:0) : 0}}< here which solved the rounding issue however it broke it for n/a defaulting it to 0.

ill revisit payload later not huge priority.
https://github.com/Code4HR/open-health-inspection-app/blob/gh-pages/js/modules/results/templates/result--template.html#L13

For me, this appears then corrects