Skip to content

Commit

Permalink
Fixed an issue with preflight checks not working when a blank templat…
Browse files Browse the repository at this point in the history
…e was uploaded on the main tab, prior to any filled out templates being uploaded.
  • Loading branch information
mike-levenick committed Aug 2, 2019
1 parent e70fd7e commit 71f8bf2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions The MUT/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class ViewController: NSViewController, URLSessionDelegate, NSTableViewDelegate,
} else if tabToGoTo == "scope" {
self.scopePreFlightChecks()

} else {
self.initialPreFlightChecks()
}
}
}
Expand Down Expand Up @@ -610,6 +612,24 @@ class ViewController: NSViewController, URLSessionDelegate, NSTableViewDelegate,
}
}

func initialPreFlightChecks() {
// If the user has actually selected a CSV template, then move on
if txtCSV.stringValue != "" {
//get the CSV from the "Browse" button and parse it into an array
csvArray = CSVMan.readCSV(pathToCSV: self.globalPathToCSV.path!, delimiter: globalDelimiter!)

if csvArray.count == 0 {
// If there are no rows in the CSV
_ = popMan.generalWarning(question: "Empty CSV Found", text: "It seems the CSV file you uploaded is malformed, or does not contain any data.\n\nPlease try a different CSV.")
} else if csvArray.count == 1 {
// If there is only 1 row in the CSV (header only)
_ = popMan.generalWarning(question: "No Data Found", text: "It seems the CSV file you uploaded does not contain any data outside of the header row.\n\nPlease select a CSV with updates for MUT to process.")
}
} else {
_ = popMan.generalWarning(question: "No CSV Found", text: "Please use the Browse button to find a CSV file on your system with updates that you would like MUT to process.")
}
}

func verifyCSV() {
// Nuke the CSV array on every preflight so we don't get stuck with old data
csvArray.removeAll()
Expand Down

0 comments on commit 71f8bf2

Please sign in to comment.