Skip to content

Commit 6489af2

Browse files
committed
[LOOP-4596] Scenario Organization
1 parent b07f825 commit 6489af2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Loop/View Controllers/TestingScenariosTableViewController.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ final class TestingScenariosTableViewController: RadioSelectionTableViewControll
1616

1717
private var scenarioURLs: [URL] = [] {
1818
didSet {
19-
options = scenarioURLs.map { $0.deletingPathExtension().lastPathComponent }
19+
options = scenarioURLs.map {
20+
$0 // /Scenarios/HF-1-Scenario_1.json
21+
.deletingPathExtension() // /Scenarios/HF-1-Scenario_1
22+
.lastPathComponent // HF-1-Scenario_1
23+
.replacingOccurrences(of: "HF-1-", with: "") // Scenario_1
24+
.replacingOccurrences(of: "HF-2-", with: "") // Scenario_1
25+
.replacingOccurrences(of: "_", with: " ") // Scenario 1
26+
}
2027
if isViewLoaded {
2128
DispatchQueue.main.async {
2229
self.updateLoadButtonEnabled()
@@ -163,6 +170,8 @@ final class TestingScenariosTableViewController: RadioSelectionTableViewControll
163170

164171
extension TestingScenariosTableViewController: TestingScenariosManagerDelegate {
165172
func testingScenariosManager(_ manager: TestingScenariosManager, didUpdateScenarioURLs scenarioURLs: [URL]) {
166-
self.scenarioURLs = scenarioURLs
173+
let rawStudyProduct = UserDefaults.appGroup?.studyProductSelection ?? "none"
174+
let studyProduct = StudyProduct(rawValue: rawStudyProduct) ?? .none
175+
self.scenarioURLs = studyProduct.filtered(scenarioURLs: scenarioURLs)
167176
}
168177
}

0 commit comments

Comments
 (0)