Skip to content

Commit

Permalink
Fix newline error
Browse files Browse the repository at this point in the history
  • Loading branch information
JetSimon committed May 2, 2023
1 parent dec1d3c commit 028da2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function extractJSON(raw_file, start, end, backup = null, backupEnd = null, requ
let f = raw_file
if(!f.includes(start)) {
if(backup != null) {
console.log(`ERROR: Start [${start}] not in file provided, trying backup`)
return extractJSON(f, backup, backupEnd == null ? end : backupEnd, null, null, required)
}

Expand Down Expand Up @@ -219,7 +220,8 @@ function loadDataFromFile(raw_json) {

let jet_data = {}

raw_json = raw_json.replaceAll("\n", "")
raw_json = raw_json.replaceAll("\n", "");
raw_json = raw_json.replaceAll("\r", "")
raw_json = raw_json.replaceAll(/ +/g, " ");

states_json = extractJSON(raw_json, "campaignTrail_temp.states_json = JSON.parse(", ");", "campaignTrail_temp.states_json = [", "]")
Expand Down
5 changes: 5 additions & 0 deletions js/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ async function loadData() {
}

function getListOfCandidates() {

if(Object.values(Vue.prototype.$TCT.candidate_issue_score).length == 0) {
return [[null, null]];
}

let arr = Object.values(Vue.prototype.$TCT.candidate_issue_score).map(c => c.fields.candidate);
arr = Array.from(new Set(arr));
arr = arr.map((c) => {
Expand Down

0 comments on commit 028da2e

Please sign in to comment.