From f5f9807fa9f5018375ac85f6cbf9b2983e133892 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Wed, 29 Jul 2020 23:01:41 -0400
Subject: [PATCH] FCTV init fix

---
 src/pregmod/FCTV/FCTV.js   |  8 ++++++++
 src/pregmod/FCTV/FCTVBC.js | 19 +++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/pregmod/FCTV/FCTV.js b/src/pregmod/FCTV/FCTV.js
index dddd2dd60bc..fe503e7d1e7 100644
--- a/src/pregmod/FCTV/FCTV.js
+++ b/src/pregmod/FCTV/FCTV.js
@@ -17,6 +17,7 @@ weekEnabled - The week FCTV was installed.
 globalThis.FCTV = (function() {
 	return {
 		channels: channels,
+		initChannels: initChannels,
 		showChannel: showChannel,
 		incrementChannel: incrementChannel,
 		incrementShow: incrementShow,
@@ -29,6 +30,13 @@ globalThis.FCTV = (function() {
 		return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
 	}
 
+	function initChannels() {
+		const channelList = FCTV.channels();
+		for (let i = 0; i < channelList.length; i++) {
+			V.FCTV.channel[num(channelList[i], true)] = 0;
+		}
+	}
+
 	function showChannel(i) {
 		let x = {
 			canSelect: 1,
diff --git a/src/pregmod/FCTV/FCTVBC.js b/src/pregmod/FCTV/FCTVBC.js
index 820799a07fe..151055542cc 100644
--- a/src/pregmod/FCTV/FCTVBC.js
+++ b/src/pregmod/FCTV/FCTVBC.js
@@ -5,15 +5,6 @@ App.Update.FCTV = function() {
 		return V.FCTVreceiver ? a : b;
 	}
 
-	function initChannels() {
-		const channelList = FCTV.channels();
-		for (let i = 0; i < channelList.length; i++) {
-			const channel = num(channelList[i], true);
-			const currentChannel = 'show' + capFirstChar(channel);
-			V.FCTV.channel[channel] = convert(V[currentChannel], V.FCTV.channel[channel]) || 0;
-		}
-	}
-
 	V.FCTV = V.FCTV || {};
 	V.FCTV.receiver = V.FCTV.receiver > -1 ? V.FCTV.receiver : -1;
 	if (convert && V.receiverAvailable) {
@@ -21,7 +12,7 @@ App.Update.FCTV = function() {
 	}
 	V.FCTV.pcViewership = V.FCTV.pcViewership || {};
 	V.FCTV.channel = V.FCTV.channel || {};
-	initChannels();
+	channelsBC();
 	V.FCTV.channel.last = convert(V.lastShow, V.FCTV.channel.last) || -1;
 
 	V.FCTV.pcViewership.count = convert(V.FCTVcount, V.FCTV.pcViewership.count) || 0;
@@ -31,4 +22,12 @@ App.Update.FCTV = function() {
 	if (V.FCTVreceiver && !V.FCTV.weekEnabled) {
 		V.FCTV.weekEnabled = V.receiverAvailable > 1 ? V.receiverAvailable : 0;
 	}
+
+	function channelsBC() {
+		const channelList = FCTV.channels();
+		for (let i = 0; i < channelList.length; i++) {
+			const channel = num(channelList[i], true);
+			V.FCTV.channel[channel] = V.FCTV.channel[channel] || 0;
+		}
+	}
 };
-- 
GitLab