Skip to content

Commit

Permalink
Merge pull request #129 from OskarAhl/oskar/fix_position_removePositi…
Browse files Browse the repository at this point in the history
…onById

oskar/fix_position_removePositionById
  • Loading branch information
ashkanx committed Jun 4, 2019
2 parents d2ba3ee + 5053f20 commit b3870b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
9 changes: 0 additions & 9 deletions src/javascript/app/Stores/Modules/Contract/contract-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default class ContractStore extends BaseStore {
@observable is_replay_static_chart = false;
// ---- Normal properties ---
forget_id;
chart_type = 'mountain';
is_from_positions = false;
is_ongoing_contract = false;
Expand All @@ -62,7 +61,6 @@ export default class ContractStore extends BaseStore {
// -------------------
@action.bound
drawChart(SmartChartStore, contract_info) {
this.forget_id = contract_info.id;
const { date_start } = contract_info;
const end_time = getEndTime(contract_info);
Expand Down Expand Up @@ -148,7 +146,6 @@ export default class ContractStore extends BaseStore {
@action.bound
onUnmountReplay() {
this.forget_id = null;
this.replay_contract_id = null;
this.digits_info = {};
this.is_ongoing_contract = false;
Expand Down Expand Up @@ -176,7 +173,6 @@ export default class ContractStore extends BaseStore {
this.contract_info = {};
this.digits_info = {};
this.error_message = '';
this.forget_id = null;
this.has_error = false;
this.is_sell_requested = false;
this.is_from_positions = false;
Expand Down Expand Up @@ -212,7 +208,6 @@ export default class ContractStore extends BaseStore {
}
if (+response.proposal_open_contract.contract_id !== +this.replay_contract_id) return;
this.forget_id = response.proposal_open_contract.id;
this.replay_info = response.proposal_open_contract;
// Add indicative status for contract
Expand Down Expand Up @@ -335,10 +330,6 @@ export default class ContractStore extends BaseStore {
SmartChartStore.updateGranularity(granularity);
}

forgetProposalOpenContract() {
WS.forget('proposal_open_contract', this.updateProposal, { id: this.forget_id });
}

waitForChartListener = (SmartChartStore) => {
// TODO: Refactor, timeout interval is required for completed contracts.
// There is an issue when we receive the proposal_open_contract response
Expand Down
12 changes: 6 additions & 6 deletions src/javascript/app/Stores/Modules/Portfolio/portfolio-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export default class PortfolioStore extends BaseStore {
@action.bound
removePositionById(contract_id) {
const is_contract_mode = this.root_store.modules.smart_chart.is_contract_mode;
let i = this.getPositionIndexById(contract_id);
// check if position to be removed is out of range from the maximum amount rendered in drawer
if (this.positions.length > 4) i += 1;
this.positions.splice(i, 1);
const { is_contract_mode } = this.root_store.modules.smart_chart;
const contract_idx = this.getPositionIndexById(contract_id);
this.positions.splice(contract_idx, 1);
// check if contract is in view in contract_mode before removing contract details from chart
if (is_contract_mode && (this.root_store.modules.contract.contract_id === contract_id)) {
if (is_contract_mode && (+this.root_store.modules.contract.contract_id === +contract_id)) {
this.root_store.modules.contract.onCloseContract();
this.root_store.modules.trade.requestProposal();
}
Expand Down

0 comments on commit b3870b2

Please sign in to comment.