Greasy Fork is available in English.

Discussions » Creation Requests

FatSecret.com Macro-Ratio Fixes

§
Posted: 2015.05.06.

FatSecret.com Macro-Ratio Fixes

Basically what the title says. The pie chart provided at the bottom of the food diary page (https://www.fatsecret.com/Diary.aspx?pa=fj) that breaks down macro-nutrient ratios has been inaccurate for as long as I can remember, and it doesn't appear that FatSecret will be fixing it themselves.

Here's the pie chart I'm talking about:


As it currently is, I think the ratios are calculated based on total carbs and fat, failing to take into account grams of fiber, leading to an underestimation of grams of protein. My idea is for the pie chart to depend primarily on (a) grams of protein and (b) grams of fat to form the ratios. It seems like this should be easy enough, but I know very little javascript, so I'm hoping someone will be kind enough to write a script that fixes it.

So something like
([grams of protein x 4 calories]/[total calories]) x 100 = protein percentage
([grams of fat x 9 calories]/[total calories]) x 100 = fat percentage
100 - (protein % + fat %) = carb percentage

§
Posted: 2015.05.10.

It does look as though that subtraction method should work for "net carbs." Does the page already contain all the numbers needed to do the computation or would it need to be retrieved in the background from somewhere else? Or in other words, would this be reasonably simple or potentially very painful.

§
Posted: 2015.05.14.

Thanks for responding - and sorry for the late reply! It should be relatively simple - in account settings, you can enable which columns/nutrients to show on your food diary, and net carbs is one of them (as are carbs, protein, fat, fiber, etc)... so it shows everything necessary to make a proper calculation, just for whatever reason they decided to make the "calorie breakdown" include fiber...

Post reply

Sign in to post a reply.