How to Track Weight Watchers Points on MFP!!

Options
12829313334

Replies

  • Odessit68
    Odessit68 Posts: 1 Member
    Options
    @alloy1028 Thank you for the script. It works great, except it doesn't seem to get all the points quite right. :smile:
    I was trying to figure out the formula that you were using and couldn't.
    The formula that I've found on another web site is (calories + 4xSugar + 9xSat.Fat - 3.2xProtein)/33
  • TC4IOWASTATE
    TC4IOWASTATE Posts: 64 Member
    Options
    Cool, cant' wait until this afternoon to try to do this. Thank you.
  • jan_michelle_clark
    jan_michelle_clark Posts: 1 Member
    Options
    I can't get the points to display in my diary what am I doing wrong?
  • heathercaldwell75
    heathercaldwell75 Posts: 2 Member
    Options
    Worked perfectly - thank you!
  • cassalon
    cassalon Posts: 1 Member
    Options
    Thank you to so many of you for your help. This used to work on Firefox, then didn't, then did occasionally. Now after tweaking line 5 and 6 of the script and removing the / - it works!
  • midsummer174627
    midsummer174627 Posts: 386 Member
    Options
    I tried Zaphod71's github script for Smart Points. I had to remove the final / from lines 6 & 7 as someone suggested, but now it works fine. . . Except that the calculations are way off. For example WW says a Haas Avocado is 7 points, but the script says it's 17.5!

    Right now I have my nutrients set in this order: Saturated Fat, Protein, Fat, Sugar, None.

    Any suggestions?
  • golfgame
    golfgame Posts: 2 Member
    Options
    Has anyone been able to update the WW pts to the new "New Smart Points"?
  • golfgame
    golfgame Posts: 2 Member
    Options
    I tried Zaphod71's github script for Smart Points. I had to remove the final / from lines 6 & 7 as someone suggested, but now it works fine. . . Except that the calculations are way off. For example WW says a Haas Avocado is 7 points, but the script says it's 17.5!

    Right now I have my nutrients set in this order: Saturated Fat, Protein, Fat, Sugar, None.

    Any suggestions?

    How about furnishing the script or a link to it? Thanks
  • Limon421
    Limon421 Posts: 23 Member
    Options
    I do mfp on my phone. But covert to points with the sp calculator. I count all foods, nothing free.
  • ahtullos
    ahtullos Posts: 2 Member
    Options
    Does anyone know of a script for WW Fit Points??
  • mboushey
    mboushey Posts: 1 Member
    edited June 2016
    Options
    This has worked for me for a few weeks and is all of a sudden only showing 0 points for everything. Anyone else experiencing this?

    Here's the link to the script I'm using: https://github.com/LeChuck71/MFP_WW_Points/raw/master/MFP_WW_Points.user.js
  • lentzche
    lentzche Posts: 2 Member
    Options
    I just installed the script and running into the same issue as mboushey - the column is there but it is only showing 0 points for everything.
  • lentzche
    lentzche Posts: 2 Member
    Options
    Zahpod71 wrote: »
    Hey glad it works for you ;)

    If you can check the points calculation and give me some feedback would be great.
    I did it on some foods and recipes and it was fine compared to the original WW tool on an ipad.

    Cheers

    I followed the instructions and the column displays, but everything just calculates to 0. Any idea what I am doing wrong?
  • Themdragons
    Themdragons Posts: 3 Member
    Options
    is this link still working for anyone.
  • heathercaldwell75
    heathercaldwell75 Posts: 2 Member
    Options
    Nto working for me anymore. It's just calculating the points to zero now. @alloy1028 or @Zahpod71 any suggestions? Thank you in advance!
  • tenreps
    tenreps Posts: 136 Member
    Options
    Really not many calories in veggie's but In fruit yes because of the sugar, the only way you could have a lot of calories in veggies is if one loads them with butter and such, and also consuming veggies by the time one digest's them they become water---that's the reason WW makes them free points.
  • debrag12
    debrag12 Posts: 1,071 Member
    Options
    Nto working for me anymore. It's just calculating the points to zero now. @alloy1028 or @Zahpod71 any suggestions? Thank you in advance!

    Not just me then
  • atirmae
    atirmae Posts: 2 Member
    Options
    Mine are all registering as zero now as well.
  • tineyd00
    tineyd00 Posts: 1 Member
    Options
    MFP changed it's column names so the script is a little wonky. I tried to submit a pull request to LeChuck71's script, but it looks like it's a read only repository. So here is the updated script that fixes that.

    All credit obviously goes to LeChuck71 & the original poster

    (function () {
    // ==UserScript==
    // @name MyFitnessPal Weight Watchers Points
    // @version 1.3
    // @description Adds display of Weight Watcher points to any daily food diary page. Also adds "Real Calories" calculation based off 4/4/9 algorithm.
    // @include http://www.myfitnesspal.com/food/diary/*
    // @include https://www.myfitnesspal.com/food/diary/*
    // ==/UserScript==
    // Originally from: http://userscripts-mirror.org/scripts/show/122949

    var usePointCalculation ="SmartPoints"; //Change to true to:
    // original
    // PointsPlus
    // SmartPoints !make sure "Saturated Fat" ist listet in your MFP diary!
    // to change calculation formula
    var precisonWW = false; //Change to true for true fractional point values (instead of just .25, .50, and .75)
    var totalPoints = 0;
    /*
    if (window.top !== window.self) {
    return; // do not run in frames
    }
    if (typeof unsafeWindow != 'undefined')
    {
    (function page_scope_runner() {
    // If we're _not_ already running in the page, grab the full source
    // of this script.
    var my_src = '(' + page_scope_runner.caller.toString() + ')();';
    // Create a script node holding this script, plus a marker that lets us
    // know we are running in the page scope (not the Greasemonkey sandbox).
    // Note that we are intentionally *not* scope-wrapping here.
    var script = document.createElement('script');
    script.setAttribute('type', 'application/javascript');
    script.textContent = my_src;
    document.body.appendChild(script);
    }) ();
    return;
    }
    */
    function startRun() {
    var script = document.createElement('script');
    script.setAttribute('src', 'http://www.google.com/jsapi');
    script.addEventListener('load', function () {
    loadscripts_1();
    }, false);
    document.body.appendChild(script);
    }
    function getPointOld(calories, fat, fiber, carbs, protein, sugar)
    {
    var points = 0;
    switch (usePointCalculation) {
    case "original":
    if (fiber > 4 ) {
    fiber = 4;
    }
    points = (calories / 50) + (fat / 12) - (fiber / 5);
    break;
    case "PointsPlus":
    points = (protein / 10.94) + (carbs / 9.17) + (fat / 3.89) - (fiber / 12.49);
    break;
    case "SmartPoints":
    points = (calories*0.0303) + (sugar*0.1212) + (fat*0.2727) - (protein*0.0970);
    break;
    }

    //alert(points);

    if (precisonWW)
    {
    points = Math.round(points);
    }
    else
    {
    var intPoints = Math.floor(points);
    fraction = points - intPoints;
    if (fraction < 0.25)
    points = intPoints + 0;
    else if (fraction >= 0.25 && fraction < 0.75)
    points = intPoints + 0.5;
    else
    points = intPoints + 1;
    }
    return points;
    }
    function main()
    {
    $('tr:first').append('<th >');
    $('tr:not(:first)').append('<td>');
    var totalFound = false;
    var diaryTable$ = $('.table0');
    var totalPoints = 0;
    var columnIndexMap = {
    calories: -1,
    carbs: -1,
    fat: -1,
    fiber: -1,
    protein: -1,
    sugar: -1,
    remove: -1
    };
    //alert($(diaryTable$[12]).text());
    diaryTable$.find('tr').each(function (rowInd)
    {
    if (rowInd === 0 && $(this).hasClass('meal_header')) {
    $(this).append('<td class="alt">' + usePointCalculation +'</td>');
    columnIndexMap = BuildColumnIndexMap($(this));
    }
    if (!totalFound && $(this).hasClass('total'))
    {
    totalFound = true;
    $(this).find('td').eq(columnIndexMap.remove).html(totalPoints);
    }
    var fiber = 0;
    var calories = 0;
    var carbs = 0;
    var fat = 0;
    var protein = 0;
    var sugar = 0;
    var cols = $(this).find('td').each(function (column)
    {
    var value = GetNumberFromCell($(this));
    console.log(value);
    switch (column) {
    case columnIndexMap.calories:
    calories = value;
    break;
    case columnIndexMap.carbs:
    carbs = value;
    break;
    case columnIndexMap.fat:
    fat = value;
    break;
    case columnIndexMap.fiber:
    fiber = value;
    break;
    case columnIndexMap.protein:
    protein = value;
    break;
    case columnIndexMap.sugar:
    sugar = value;
    break;
    case columnIndexMap.remove-1:
    if ($(this).hasClass('delete')) {
    var points = getPointOld(calories, fat, fiber, carbs, protein, sugar);
    totalPoints += points;
    $(this).next().append(points);
    }
    break;
    }
    });
    });
    }
    function BuildColumnIndexMap(row$) {
    var columnIndexMap = {
    calories: -1,
    carbs: -1,
    fat: -1,
    fiber: -1,
    protein: -1,
    remove: -1
    };

    row$.find('td').each(function (index) {
    var text = $(this).text();
    if (text.indexOf("Calories") != -1)
    {
    columnIndexMap.calories = index;
    }
    else if (text.indexOf("Carbs") != -1)
    {
    columnIndexMap.carbs = index;
    }
    else if (text.indexOf("Fat") != -1)
    {
    columnIndexMap.fat = index;
    }
    else if (text.indexOf("Fiber") != -1)
    {
    columnIndexMap.fiber = index;
    }
    else if (text.indexOf("Protein") != -1)
    {
    columnIndexMap.protein = index;
    }
    else if (text.indexOf("Sugar") != -1)
    {
    columnIndexMap.sugar = index;
    }

    });

    columnIndexMap.remove = row$.find('td').length;

    return columnIndexMap;
    }
    function GetNumberFromCell(cell) {
    return parseInt(cell.text().replace(',', ''), 10);
    }
    function loadscripts_1()
    {
    var script = document.createElement('script');
    script.setAttribute('src', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js');
    script.addEventListener('load', function () {
    loadscripts_2();
    }, false);
    document.body.appendChild(script);
    }
    function loadscripts_2()
    {
    jQuery.noConflict();
    /* fix for old prototype conflict with google viz api */
    /* retrieves the Array reduce native function using cleverness */
    var ifr = document.createElement('iframe');
    document.body.appendChild(ifr);
    Array.prototype.reduce = ifr.contentWindow.Array.prototype.reduce;
    document.body.removeChild(ifr);
    google.load('visualization', '1', {
    packages: [
    'corechart'
    ],
    'callback': main
    });
    }
    startRun();
    })();
  • dwchin
    dwchin Posts: 1 Member
    Options
    tineyd00 wrote: »
    MFP changed it's column names so the script is a little wonky. I tried to submit a pull request to LeChuck71's script, but it looks like it's a read only repository. So here is the updated script that fixes that.

    All credit obviously goes to LeChuck71 & the original poster

    Thank you!! The revised script fixed it. Nerd question, but how did you figure out the new column names?