From 7ba1f17fbaa03aa3cae560dd437d5de30c944107 Mon Sep 17 00:00:00 2001 From: Deniz Duezgoeren Date: Mon, 22 Jul 2019 14:32:38 +0200 Subject: [PATCH] Changed test URLs to read URLs, added string for empty personal plan --- AvH Plan/DataFetcher.swift | 13 +++- .../xcschemes/SQLite.swift.xcscheme | 71 +++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Pods/Pods.xcodeproj/xcuserdata/kduez.xcuserdatad/xcschemes/SQLite.swift.xcscheme diff --git a/AvH Plan/DataFetcher.swift b/AvH Plan/DataFetcher.swift index 0e463a4..c72747c 100644 --- a/AvH Plan/DataFetcher.swift +++ b/AvH Plan/DataFetcher.swift @@ -34,8 +34,8 @@ class DataFetcher { func doAsync(do task: String, completionHandler: @escaping (_ substitutions: [Any]) -> ()) { DispatchQueue(label: "work-queue").async { - let foodUrl = "https://djd4rkn355.github.io/food_test.html" - let url = "https://djd4rkn355.github.io/subst_test.html" + let foodUrl = "https://djd4rkn355.github.io/food.html" + let url = "https://djd4rkn355.github.io/subst.html" Alamofire.request(url).responseString { response in if let html = response.result.value { Alamofire.request(foodUrl).responseString { response in @@ -54,6 +54,7 @@ class DataFetcher { var info = "" var infoList = [String]() var menuList = [String]() + var isPersonalEmpty = true do { let doc = try SwiftSoup.parse(html) @@ -112,6 +113,7 @@ class DataFetcher { let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional, date <- mDate, time <- mTime, room <- mRoom) _ = try db.run(insertPersonal) + isPersonalEmpty = false } } } else if courses != nil && courses != "" && classes != nil && classes != "" { @@ -123,6 +125,7 @@ class DataFetcher { let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional, date <- mDate, time <- mTime, room <- mRoom) _ = try db.run(insertPersonal) + isPersonalEmpty = false } } } @@ -130,6 +133,12 @@ class DataFetcher { } + if isPersonalEmpty { + personalSubst.append(SubstModel(group: NSLocalizedString("personal_plan_empty", comment: ""), course: "", additional: "", date: "", time: "", room: "")) + let insertPersonal = personal.insert(group <- NSLocalizedString("personal_plan_empty", comment: ""), course <- "", additional <- "", date <- "", time <- "", room <- "") + _ = try db.run(insertPersonal) + } + let pi: Elements = try doc.select("p") for item in pi { diff --git a/Pods/Pods.xcodeproj/xcuserdata/kduez.xcuserdatad/xcschemes/SQLite.swift.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/kduez.xcuserdatad/xcschemes/SQLite.swift.xcscheme new file mode 100644 index 0000000..9a777db --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/kduez.xcuserdatad/xcschemes/SQLite.swift.xcscheme @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +