Allow the workflow goal gap in any range between 1..goal-1

develop
Alexander Gavrilov 2012-11-19 18:59:58 +04:00
parent 767c1b9368
commit f587d603e8
2 changed files with 3 additions and 5 deletions

@ -326,9 +326,8 @@ public:
void setGoalCount(int v) { config.ival(0) = v; }
int goalGap() {
int cval = (config.ival(1) <= 0) ? 5 : config.ival(1);
int cmax = std::max(goalCount()-5, goalCount()/2);
return std::max(1, std::min(cmax, cval));
int cval = (config.ival(1) <= 0) ? std::min(5,goalCount()/2) : config.ival(1);
return std::max(1, std::min(goalCount()-1, cval));
}
void setGoalGap(int v) { config.ival(1) = v; }

@ -387,8 +387,7 @@ end
function NewConstraint:onRangeChange()
local cons = self.constraint
local lim = math.max(cons.goal_value-5, math.floor(cons.goal_value/2))
cons.goal_gap = math.max(1, math.min(cons.goal_gap, lim))
cons.goal_gap = math.max(1, math.min(cons.goal_gap, cons.goal_value-1))
end
JobConstraints = defclass(JobConstraints, guidm.MenuOverlay)