Fix played status in webstudio

This commit is contained in:
Matthew Stratford 2021-06-06 15:46:03 +01:00
parent a6144b2eab
commit 1e53edea2c

View file

@ -260,21 +260,25 @@ export const {
export const setItemPlayed = ( export const setItemPlayed = (
itemid: string, itemid: string,
played: boolean, played: boolean
player: number | null = null
): AppThunk => async (dispatch, getState) => { ): AppThunk => async (dispatch, getState) => {
// The server handles marking things played
// TODO: Add support in BAPSicle for marking things played
if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
if (played) { if (played) {
return; return;
} }
var weight = -1; var weight = -1;
var player = null;
if (itemid) { if (itemid) {
const idx = getState().showplan.plan!.findIndex( const idx = getState().showplan.plan!.findIndex(
(x) => itemId(x) === itemid (x) => itemId(x) === itemid
); );
weight = getState().showplan.plan![idx].weight; weight = getState().showplan.plan![idx].weight;
player = getState().showplan.plan![idx].channel;
} }
if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
if (player) { if (player) {
sendBAPSicleChannel({ sendBAPSicleChannel({
channel: player, channel: player,
@ -288,11 +292,8 @@ export const setItemPlayed = (
}); });
} }
return; return;
} else {
dispatch(
showplan.actions.setItemPlayed({ itemId: itemid, played: played })
);
} }
dispatch(showplan.actions.setItemPlayed({ itemId: itemid, played: played }));
}; };
export const moveItem = ( export const moveItem = (