Skip to content

Commit 30a61e1

Browse files
committed
Updating to handle election day call centers (which changed names again!)
1 parent a394d7f commit 30a61e1

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Biden – Dialpad",
33
"description": "Provides additinoal Dialpad behavior to the Biden for America national voter hotline team.",
4-
"version": "1.5.2",
4+
"version": "1.5.3",
55
"manifest_version": 2,
66
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
77
"background": {

src/popup.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ async function refreshCallCenterDefs(_app) {
108108
while (currentCallCenterIndex < numCallCenters) {
109109
currentCallCenterPrefix = _app.callCenterDefs[currentCallCenterIndex].display_name;
110110
currentCallCenterRun = 1;
111-
111+
112+
// as of 10/29, the election day call centers are of the form "ED " + <State> + " <Letter><Number>"
113+
// in this case, use "ED " + <State> as the prefix to match a run against
114+
let prefixMatch = currentCallCenterPrefix.match(new RegExp("(ED .+) ([A-Z][0-9]*)"));
115+
if (prefixMatch && prefixMatch.length > 1) currentCallCenterPrefix = prefixMatch[1];
116+
112117
if (!_app.denylistedShiftPrefixes.includes(currentCallCenterPrefix)) {
113118
while (currentCallCenterRun + currentCallCenterIndex < numCallCenters) {
114119
// as of 10/26 we now have call centers named <State>, <State Letter>, and <State LetterNumber>
@@ -169,8 +174,8 @@ const app = new Vue({
169174
headers: [],
170175
callCenterDefs: [],
171176
checkedCallCenterIds: [],
172-
shiftSuffixes: ["A", "B", "C", "D", "E", "F"],
173-
denylistedShiftPrefixes: ["National Spanish"],
177+
shiftSuffixes: ["A", "B", "C", "D", "E", "F", "A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"],
178+
denylistedShiftPrefixes: ["National Spanish", "ED Spanish"],
174179
shiftCallCenterDefsBySuffix: [],
175180
isAssigning: false,
176181
hasAssigned: false,
@@ -213,14 +218,21 @@ const app = new Vue({
213218
this.checkedCallCenterIds = [...this.userData.call_center_ids];
214219
},
215220
displayNameForCallCenterName: function(callCenterName) {
216-
const shiftDisplayTimes = [ "(6am ET)", "(9am ET)", "(12pm ET)", "(3pm ET)", "(6pm ET)", "(9pm ET)"];
221+
const shiftDisplayTimes = [ "(6am ET)", "(9am ET)", "(12pm ET)", "(3pm ET)", "(6pm ET)", "(9pm ET)", "(ED 5am ET)", "(ED 5am ET)", "(ED 5am ET)", "(ED 11am ET)", "(ED 11am ET)", "(ED 11am ET)", "(ED 5pm ET)", "(ED 5pm ET)", "(ED 5pm ET)"];
222+
const EDShiftDisplayTimes = ["(ED 5am ET)", "(ED 11am ET)", "(ED 5pm ET)"];
223+
const EDPrefix = "ED ";
217224

218225
// special case denylisted shift call centers that are at 6am because they don't have the A suffix
219226
if (this.denylistedShiftPrefixes.includes(callCenterName)) return callCenterName + " " + shiftDisplayTimes[0];
220227

221228
for (let shiftIndex = 0; shiftIndex < this.shiftSuffixes.length; shiftIndex++) {
222229
if (callCenterName.endsWith(" " + this.shiftSuffixes[shiftIndex])) {
223-
return callCenterName + " " + shiftDisplayTimes[shiftIndex];
230+
if (callCenterName.startsWith(EDPrefix) && shiftIndex < 3) {
231+
// Spanish call centers have the format ED Spanish <Letter> so they don't have an ED-specific suffix
232+
return callCenterName + " " + EDShiftDisplayTimes[shiftIndex];
233+
} else {
234+
return callCenterName + " " + shiftDisplayTimes[shiftIndex];
235+
}
224236
}
225237
}
226238
return callCenterName;

0 commit comments

Comments
 (0)