Skip to content

Commit

Permalink
Add some limitations to the worker budget object loop
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Nov 1, 2017
1 parent b2a313f commit 0bf805f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/components/Account/AccountVoting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ class AccountVoting extends React.Component {
static propTypes = {
initialBudget: ChainTypes.ChainObject.isRequired,
globalObject: ChainTypes.ChainObject.isRequired,
dynamicGlobal: ChainTypes.ChainObject.isRequired,
proxy: ChainTypes.ChainAccount.isRequired
};

static defaultProps = {
initialBudget: SettingsStore.getState().viewSettings.get("lastBudgetObject", "2.13.1"),
globalObject: "2.0.0",
dynamicGlobal: "2.1.0"
globalObject: "2.0.0"
};

constructor(props) {
Expand Down Expand Up @@ -362,14 +360,16 @@ class AccountVoting extends React.Component {

this.setState({lastBudgetObject: newID});
} else {
if (lastBudgetObject !== "2.13.1") {
let newBudgetObjectId = parseInt(lastBudgetObject.split(".")[2], 10) - 1;
const newBudgetObjectId = parseInt(lastBudgetObject.split(".")[2], 10) - 1;
if (typeof newBudgetObjectId === "number" && newBudgetObjectId > 1) {

const lastId = Math.max(1, newBudgetObjectId - 1);
this.setState({
lastBudgetObject: "2.13." + (newBudgetObjectId - 1)
lastBudgetObject: "2.13." + lastId
});

SettingsActions.changeViewSetting.defer({
lastBudgetObject: "2.13." + (newBudgetObjectId - 1)
lastBudgetObject: "2.13." + lastId
});
}
}
Expand Down

0 comments on commit 0bf805f

Please sign in to comment.