diff --git a/addon/data/api.js b/addon/data/api.js index f3c845f..245453c 100644 --- a/addon/data/api.js +++ b/addon/data/api.js @@ -15,9 +15,11 @@ function ApplyFilter(ratingFilterRange, restaurantEntries, excludeNoData) { var ratingElement = $("div#nomorvom[data-rating]", this); if (ratingElement.length) { var rating = $("div#nomorvom[data-rating]", this).attr("data-rating"); - if ( ((rating == -1) && excludeNoData) || (rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1]) ) { + //if ( ((rating == -1) && excludeNoData) || (rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1]) ) { + if ( (rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1]) ) { $(this).hide(); } + else { $(this).show(); } } else { $(this).show(); } }); @@ -122,7 +124,7 @@ restaurantEntries.each(function () { _this.append(scorePlaceholder); - var rating = -1; + var rating = 0; $.ajax({ url: url, @@ -133,7 +135,7 @@ restaurantEntries.each(function () { if (data.establishments.length > 0) { scorePlaceholder.removeChild(loadingText); scorePlaceholder.removeChild(loaderImg); - rating = data.establishments[0].RatingValue; + rating = data.establishments[0].RatingValue; for (var i = 0; i < rating; i++) { AppendImg(scorePlaceholder, '48-fork-and-knife-icon.png'); } @@ -144,8 +146,15 @@ restaurantEntries.each(function () { resultText.id = "hygieneScore" resultText.style.fontWeight = "bold"; resultText.style.margin = "0px 5px"; - $(resultText).text("Hygiene Score : " + rating + "/5"); - + + + if (rating == "AwaitingInspection") { + $(resultText).text("This takeaway is awaiting inspection"); + rating = 0; + } + else { + $(resultText).text("Hygiene Score : " + rating + "/5"); + } scorePlaceholder.appendChild(resultText); $(scorePlaceholder).attr("data-rating", rating); @@ -167,8 +176,9 @@ restaurantEntries.each(function () { } var ratingFilterRange = $(scoreFilterSlider).slider("values"); - var excludeNoData = $(excludeNoDataCheckbox).prop('checked'); - if ( ((rating == -1) && excludeNoData) || (rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1]) ) { + //var excludeNoData = $(excludeNoDataCheckbox).prop('checked'); + //if ( ((rating == -1) && excludeNoData) || (rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1]) ) { + if ((rating < ratingFilterRange[0]) || (rating > ratingFilterRange[1])) { _this.hide(); } else diff --git a/addon/nomorvom.xpi b/addon/nomorvom.xpi index 4e4ba37..be409ab 100644 Binary files a/addon/nomorvom.xpi and b/addon/nomorvom.xpi differ diff --git a/addon/package.json b/addon/package.json index 27bea8e..df27254 100644 --- a/addon/package.json +++ b/addon/package.json @@ -5,5 +5,5 @@ "description": "Never eat from a dodgy takeaway again. Display food.gov.uk food hygiene scores in your Just Eat search results.", "author": "Richard Dutton", "license": "MPL 2.0", - "version": "0.12" + "version": "0.13" }