Skip to content

Commit

Permalink
dbfmeal
Browse files Browse the repository at this point in the history
  • Loading branch information
araczkowski committed Mar 8, 2017
1 parent 47d73ad commit 01a943c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
15 changes: 12 additions & 3 deletions app/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@

}

function _changeBasedOn(basedon) {
function _changeBasedOn(basedon, dbfmeal) {
//
_setBasedOn(basedon);
// set meal
Expand All @@ -540,6 +540,10 @@
})
if (basedon === 'PLAN') {
m.attr('data-fmeal', m.attr('data-meal'));
} else if (basedon === 'REAL') {
m.attr('data-fmeal', m.attr('data-rmeal'));
} else if (basedon === 'USER') {
m.attr('data-fmeal', dbfmeal);
}
if ($(m).hasClass('mealOff')) {
_mealOff(true);
Expand Down Expand Up @@ -990,11 +994,16 @@
_setWidth();
};

this.setBasedOn = function(newbasedon) {
this.setBasedOn = function(newbasedon, dbfmeal) {
if (newbasedon !== 'PLAN' && newbasedon !== 'REAL' && newbasedon !== 'USER') {
return;
}
_changeBasedOn(newbasedon);
if (newbasedon !== 'USER') {
_changeBasedOn(newbasedon);
} else {
// the dbfmeal is set only in case of USER mode
_changeBasedOn(newbasedon, dbfmeal);
}
};

this.getOption = function(option) {
Expand Down
4 changes: 2 additions & 2 deletions app/testBlocks13h.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"excused": "Y"
}],
"meal": "1",
"rmeal": "0",
"rmeal": "1",
"fmeal": "0",
"basedon": "REAL"
"basedon": "USER"
}
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}
i.AddIcon > svg{
height: 1em;
}</style><body style="margin-top: 2em"><div id=bipSchedule_parent style="float:left; display: inline-block"></div><script src=scripts/adf78aaf.vendor.js></script><script src=scripts/6231b7d0.main.js></script><script>var clickB;
}</style><body style="margin-top: 2em"><div id=bipSchedule_parent style="float:left; display: inline-block"></div><script src=scripts/adf78aaf.vendor.js></script><script src=scripts/c7e32e29.main.js></script><script>var clickB;
// test url
//http://localhost:3000/?params={"options":{"min":360,"max":1140,"mode":"real"},"schedule":{"blocks":[{"id":1,"start":480,"value":60,"planned":"1","real":"1"}],"meal":"1","rmeal":"1"}}

Expand Down
Loading

0 comments on commit 01a943c

Please sign in to comment.