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) => {
if (played) { // The server handles marking things played
return; // TODO: Add support in BAPSicle for marking things played
}
var weight = -1;
if (itemid) {
const idx = getState().showplan.plan!.findIndex(
(x) => itemId(x) === itemid
);
weight = getState().showplan.plan![idx].weight;
}
if (process.env.REACT_APP_BAPSICLE_INTERFACE) { if (process.env.REACT_APP_BAPSICLE_INTERFACE) {
if (played) {
return;
}
var weight = -1;
var player = null;
if (itemid) {
const idx = getState().showplan.plan!.findIndex(
(x) => itemId(x) === itemid
);
weight = getState().showplan.plan![idx].weight;
player = getState().showplan.plan![idx].channel;
}
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 = (