Skip to content

Commit

Permalink
fix tally issue
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdadams committed Sep 13, 2024
1 parent d53f913 commit d01bc9b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
2 changes: 1 addition & 1 deletion UI/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tallyarbiter-ui",
"version": "3.1.0",
"version": "3.1.1",
"scripts": {
"prestart": "node git.version.js && cd .. && npm run redundancyjs",
"prebuild": "node git.version.js && cd .. && npm run redundancyjs",
Expand Down
2 changes: 1 addition & 1 deletion UI/src/app/_services/socket.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class SocketService {
this.outputTypes = outputTypes;
this.outputTypeDataFields = outputTypesDataFields;
this.busOptions = busOptions;
this.busOptionsVisible = busOptions.filter((b) => b.visible);
this.busOptionsVisible = busOptions.filter((b) => b.visible == true || b.visible == undefined);
this.sources = this.prepareSources(sourcesData);
this.devices = devicesData;
this.deviceSources = deviceSources;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tallyarbiter",
"version": "3.1.0",
"version": "3.1.1",
"description": "The flexible and customizable tally system",
"keywords": [
"util",
Expand Down
54 changes: 51 additions & 3 deletions src/sources/_Source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ export class TallyInput extends EventEmitter {
}

protected addBusToAddress(address: string, bus: string) {
//replace bus with its real id if it is "preview" or "program" or "aux"
if (bus === "preview") {
bus = currentConfig.bus_options.find((b) => b.type === "preview").id;
}
else if (bus === "program") {
bus = currentConfig.bus_options.find((b) => b.type === "program").id;
}
else if (bus === "aux") {
bus = currentConfig.bus_options.find((b) => b.type === "aux").id;
}

if (!Array.isArray(this.tallyData[address])) {
this.tallyData[address] = [];
}
Expand All @@ -142,6 +153,17 @@ export class TallyInput extends EventEmitter {
}

protected removeBusFromAddress(address: string, bus: string) {
//replace bus with its real id if it is "preview" or "program" or "aux"
if (bus === "preview") {
bus = currentConfig.bus_options.find((b) => b.type === "preview").id;
}
else if (bus === "program") {
bus = currentConfig.bus_options.find((b) => b.type === "program").id;
}
else if (bus === "aux") {
bus = currentConfig.bus_options.find((b) => b.type === "aux").id;
}

if (!Array.isArray(this.tallyData[address])) {
this.tallyData[address] = [];
} else {
Expand All @@ -150,6 +172,17 @@ export class TallyInput extends EventEmitter {
}

protected removeBusFromAllAddresses(bus: string) {
//replace bus with its real id if it is "preview" or "program" or "aux"
if (bus === "preview") {
bus = currentConfig.bus_options.find((b) => b.type === "preview").id;
}
else if (bus === "program") {
bus = currentConfig.bus_options.find((b) => b.type === "program").id;
}
else if (bus === "aux") {
bus = currentConfig.bus_options.find((b) => b.type === "aux").id;
}

for (const address of Object.keys(this.tallyData)) {
this.tallyData[address] = this.tallyData[address].filter((b) => b !== bus);
}
Expand All @@ -173,8 +206,6 @@ export class TallyInput extends EventEmitter {
}
}

//console.log("realBusses", realBusses);

this.tallyData[address] = realBusses || [];
}

Expand All @@ -191,8 +222,25 @@ export class TallyInput extends EventEmitter {
}

protected sendIndividualTallyData(address: string, busses: string[]) {
//if bus is "preview" or "program", find its real bus id and use that instead because many source types use those words instead of the actual busId
let realBusses = [];
for (let bus of busses) {
if (bus === "preview") {
realBusses.push(currentConfig.bus_options.find((b) => b.type === "preview").id);
}
else if (bus === "program") {
realBusses.push(currentConfig.bus_options.find((b) => b.type === "program").id);
}
else if (bus === "aux") {
realBusses.push(currentConfig.bus_options.find((b) => b.type === "aux").id);
}
else {
realBusses.push(bus);
}
}

let individualTallyData = {};
individualTallyData[address] = busses;
individualTallyData[address] = realBusses || [];
this.tally.next(individualTallyData);
}
}

0 comments on commit d01bc9b

Please sign in to comment.