Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOOK 1191 - Fix bug involving event statuses not being properly read #38

Open
wants to merge 4 commits into
base: BOOK-769-Sportsbook
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"vars": "all", "args": "after-used"
}],
"keyword-spacing": ["error", { "before": true, "after": true }],
"comma-dangle": "off",
"comma-dangle": "error",
"indent": ["error", 2, {"SwitchCase": 1}],
"quotes": ["error", "single"],
"semi": ["error", "always"],
Expand Down
2 changes: 1 addition & 1 deletion src/assets/icons/mbitfun_icon_black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/components/App/TitleBar/SportsbookToggle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SportsbookToggle extends PureComponent {
SportsbookToggle.propTypes = {
bookMode: PropTypes.string,
setMode: PropTypes.func,
navigateTo: PropTypes.func,
navigateTo: PropTypes.func
};

const mapStateToProps = (state) => {
Expand Down Expand Up @@ -99,7 +99,7 @@ const mapStateToProps = (state) => {
} else if (objectType === ChainTypes.object_type.event.toString()) {
// We want to have the 'first' bmgID on hand incase the user toggles to the sportsbook
let bmg = EventPageSelector.getFirstBettingMarketGroupByEventId(state, {
eventId: blockchainObject,
eventId: blockchainObject
});

if (bmg) {
Expand All @@ -112,15 +112,15 @@ const mapStateToProps = (state) => {
return {
bookMode: state.getIn(['app', 'bookMode']),
previousRoute: state.getIn(['routing', 'previousRoute']),
sportID, eventGroupID, eventID, bmgID,
sportID, eventGroupID, eventID, bmgID
};
};

const mapDispatchToProps = (dispatch) => {
return bindActionCreators(
{
setMode: AppActions.setBookMode,
navigateTo: NavigateActions.navigateTo,
navigateTo: NavigateActions.navigateTo
},
dispatch
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/TitleBar/TitleBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ TitleBar.propTypes = {

const mapStateToProps = (state) => {
return {
loggedIn: state.getIn(['account', 'isLoggedIn']),
loggedIn: state.getIn(['account', 'isLoggedIn'])
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/BettingDrawers/Common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export {
Overlay,
Waiting,
PlaceBetConfirm,
OverlayUtils,
OverlayUtils
};
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BackingBettingWidget extends PureComponent {
}

BackingBettingWidget.propTypes = {
isLiveMarket: PropTypes.bool.isRequired,
isLiveMarket: PropTypes.bool.isRequired
};

const mapDispatchToProps = (dispatch) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BackingWidgetContainer extends PureComponent {
title={ this.props.eventName }
eventID={ this.props.marketData.get('event_id') }
eventTime={ this.props.eventTime }
eventStatus={ this.props.marketData.get('status') }
eventStatus={ this.props.eventStatus }
eventRoute={ this.props.eventRoute }
columnType={ this.props.marketData.get('description') }
marketData={ this.props.marketData }
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Login extends PureComponent {

const mapStateToProps = (state) => ({
errors: state.getIn(['auth', 'loginErrors']),
status: state.getIn(['auth', 'loginLoadingStatus']),
status: state.getIn(['auth', 'loginLoadingStatus'])
});

const mapDispatchToProps = (dispatch) => bindActionCreators(
Expand Down
6 changes: 3 additions & 3 deletions src/components/SportsBookEvent/SportsBookEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
EventGroupPageSelector,
MarketDrawerSelector,
MyAccountPageSelector,
EventPageSelector,
EventPageSelector
} from '../../selectors';

class SportsBookEvent extends PureComponent {
Expand Down Expand Up @@ -103,7 +103,7 @@ const mapStateToProps = (state, ownProps) => {

let props = {
event,
oddsFormat: MyAccountPageSelector.oddsFormatSelector(state),
oddsFormat: MyAccountPageSelector.oddsFormatSelector(state)
};

// Populate other properties if betting market group exists
Expand All @@ -119,7 +119,7 @@ const mapStateToProps = (state, ownProps) => {
unconfirmedBets: BettingMarketGroupPageSelector.getUnconfirmedBets(state, ownProps),
loadingStatus: BettingMarketGroupPageSelector.getLoadingStatus(state, ownProps),
canCreateBet: MarketDrawerSelector.canAcceptBet(state, ownProps),
sportName,
sportName
});
}

Expand Down
12 changes: 6 additions & 6 deletions src/constants/BackingWidgetTypes.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const orderPriority = {
TOP: 0,
MIDDLE: 5,
BOTTOM: 10,
BOTTOM: 10
};

// This constant object maps onto BMG descriptions produced by BOS
const BackingWidgetTypes = {
MATCHODDS: 'MATCHODDS',
MONEYLINE: 'MONEYLINE',
OVERUNDER: 'OVERUNDER',
OVERUNDER: 'OVERUNDER'
};

const BackingWidgetLayouts = {
Expand All @@ -18,22 +18,22 @@ const BackingWidgetLayouts = {
default: 8
},
order: orderPriority.TOP, // Highest Priority, always show on the top.
numberOfMarkets: 3,
numberOfMarkets: 3
},
MONEYLINE: {
columns: {
eventFlag: 7,
default: 12
},
order: orderPriority.TOP, // Highest Priority, always show on the top.
order: orderPriority.TOP // Highest Priority, always show on the top.
},
OVERUNDER: {
columns: {
eventFlag: 12,
default: 12
},
order: orderPriority.MIDDLE, // Middle priority, show below the top.
},
order: orderPriority.MIDDLE // Middle priority, show below the top.
}
};

export {BackingWidgetTypes, BackingWidgetLayouts};
2 changes: 1 addition & 1 deletion src/constants/BookieModes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const BookieModes = {
EXCHANGE: 'exchange',
SPORTSBOOK: 'sportsbook',
SPORTSBOOK: 'sportsbook'
};
export default BookieModes;
4 changes: 2 additions & 2 deletions src/constants/LayoutConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const LayoutConstants = {
betslipWidth: 360,
splitPaneStyle: {
top: '0px',
position: 'fixed',
},
position: 'fixed'
}
};

export default LayoutConstants;
2 changes: 1 addition & 1 deletion src/constants/MessageId.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const MessageId = {
INCOMPLETE_BET: 'war-b-IB'
},
ERROR: {
INSUFFICIENT_FUNDS: 'err-b-IF',
INSUFFICIENT_FUNDS: 'err-b-IF'
}
},
EXCHANGE: {
Expand Down
2 changes: 1 addition & 1 deletion src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ export {
BettingMarketResolutionTypes,
BookieModes,
BackingWidgetTypes,
LayoutConstants,
LayoutConstants
};
4 changes: 2 additions & 2 deletions src/reducers/AppReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const initialState = Immutable.fromJS({
isTitleBarTransparent: true,
gatewayAccount: {},
showLicenseScreen: false,
bookMode: BookieModes.EXCHANGE,
bookMode: BookieModes.EXCHANGE

});

Expand Down Expand Up @@ -117,7 +117,7 @@ export default function(state = initialState, action) {

case ActionTypes.APP_SET_BOOK_MODE: {
return state.merge({
bookMode: action.mode,
bookMode: action.mode
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/selectors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export {
MyAccountPageSelector,
QuickBetDrawerSelector,
SidebarSelector,
SportPageSelector,
SportPageSelector
};
18 changes: 14 additions & 4 deletions src/utility/SportsbookUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,30 @@ const sortAndCenter = (bettingMarketGroups) => {
};

const isAbleToBet = (eventStatus) => {
let canBet = true;

if (eventStatus) {
switch (eventStatus[1]) {
let status = eventStatus;

// Err Handling, in case data does not come as an array.
if (eventStatus.constructor === Array) {
status = eventStatus[1];
}

switch (status) {
case EventStatus.FINISHED:
case EventStatus.FROZEN:
case EventStatus.COMPLETED:
case EventStatus.SETTLED:
case EventStatus.CANCELED:
return false;
canBet = false;
break;
default:
return true;
break;
}
}

return true;
return canBet;
};

const hasBettingMarkets = (bettingMarketGroup) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utility/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export {
ObjectUtils,
HelpAndSupportUtils,
AuthUtils,
SportsbookUtils,
SportsbookUtils
};