Skip to content

Commit

Permalink
worked on task well-2317
Browse files Browse the repository at this point in the history
  • Loading branch information
majin22 committed Oct 21, 2023
1 parent 3939077 commit cd1ca81
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 36 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nutrition-label-jquery-plugin",
"version": "11.0.12",
"version": "11.0.13",
"homepage": "https://github.com/nutritionix/nutrition-label",
"authors": [
"Leo Joseph Gajitos <leejay22@gmail.com>",
Expand Down
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

version 11.0.13 - October 21, 2023

- change how the 2018 %DV are computed for Potassium, Vitamin D, Calcium and Iron) https://github.com/nutritionix/nutrition-label/issues/142

------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------

version 11.0.12 - September 21, 2023

- REVERTED - Remove Total Sugars %DV from Legacy and 2018 Label Versions https://github.com/nutritionix/nutrition-label/issues/141#issuecomment-1728379600
Expand Down
2 changes: 1 addition & 1 deletion dist/css/nutritionLabel-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/nutritionLabel.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.12 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down
5 changes: 2 additions & 3 deletions dist/js/nutritionLabel-min.js

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions dist/js/nutritionLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.12 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down Expand Up @@ -1790,20 +1790,14 @@

if ( $.inArray(unitIndex, ["unitVitaminD_base", "unitCalcium_base", "unitIron_base", "unitPotassium_base"]) !== -1) {
//for the vitamins and minerals for 2018 value when the base value is given and the %DV is computed
let computedPercentDVValue = (
(
$localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]
) /
(
$localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2)
)
) * 100;
let dvDivisor = $localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2);
let computedPercentDVValue = ( ($localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]) / dvDivisor ) * 100;

localNutritionLabel += $localSettings[naIndex] ?
localNaValue :
!$localSettings.allowFDARounding ?
roundLoDash(computedPercentDVValue, $localSettings.decimalPlacesForDailyValues) :
roundVitaminsCalciumIron(computedPercentDVValue);
roundVitaminsCalciumIron( ($localSettings[valueIndex] / dvDivisor) * 100 );
} else {
//https://github.com/nutritionix/nutrition-label/wiki/How-the-Percent-Daily-Value-is-Computed
localNutritionLabel += $localSettings[naIndex] ?
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.12 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand All @@ -29,7 +29,7 @@
<body>
<div class="container" style="width: 1250px;">
<div class="hero-unit">
<h1>Nutrition Label version 11.0.12</h1>
<h1>Nutrition Label version 11.0.13</h1>
<h4>from Nutritionix</h4>
<h4><a href="http://github.com/nutritionix/nutrition-label" target="_newDemo">Homepage</a></h4>
<p>
Expand Down
2 changes: 1 addition & 1 deletion nutritionLabel-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions nutritionLabel-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nutritionLabel-stable-ver-11.0.4.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.10 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down
2 changes: 1 addition & 1 deletion nutritionLabel-stable-ver-11.0.4.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.10 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down
2 changes: 1 addition & 1 deletion nutritionLabel.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.12 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down
14 changes: 4 additions & 10 deletions nutritionLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 11.0.12 |
* @current version 11.0.13 |
* @stable version 11.0.4 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down Expand Up @@ -1790,20 +1790,14 @@

if ( $.inArray(unitIndex, ["unitVitaminD_base", "unitCalcium_base", "unitIron_base", "unitPotassium_base"]) !== -1) {
//for the vitamins and minerals for 2018 value when the base value is given and the %DV is computed
let computedPercentDVValue = (
(
$localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]
) /
(
$localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2)
)
) * 100;
let dvDivisor = $localSettings[dailyValueIndex] == 0 ? 1 : $localSettings[dailyValueIndex] * roundLoDash(parseFloat($localSettings.calorieIntake) / 2000, 2);
let computedPercentDVValue = ( ($localSettings.allowFDARounding ? eval(roundFunctionRuleName)($localSettings[valueIndex]) : $localSettings[valueIndex]) / dvDivisor ) * 100;

localNutritionLabel += $localSettings[naIndex] ?
localNaValue :
!$localSettings.allowFDARounding ?
roundLoDash(computedPercentDVValue, $localSettings.decimalPlacesForDailyValues) :
roundVitaminsCalciumIron(computedPercentDVValue);
roundVitaminsCalciumIron( ($localSettings[valueIndex] / dvDivisor) * 100 );
} else {
//https://github.com/nutritionix/nutrition-label/wiki/How-the-Percent-Daily-Value-is-Computed
localNutritionLabel += $localSettings[naIndex] ?
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nutrition-label-jquery-plugin",
"version": "11.0.12",
"version": "11.0.13",
"description": "To be able to create a FDA-style nutrition label with any nutrition data source",
"main": "nutritionLabel-min.js",
"dependencies": {},
Expand Down

0 comments on commit cd1ca81

Please sign in to comment.