Changed test URLs to read URLs, added string for empty personal plan

This commit is contained in:
Deniz Duezgoeren
2019-07-22 14:32:38 +02:00
parent e04d458b8b
commit 7ba1f17fba
2 changed files with 82 additions and 2 deletions
+11 -2
View File
@@ -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 {
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B655D8DA4BAF38217006FCA56ECD4127"
BuildableName = "SQLite.framework"
BlueprintName = "SQLite.swift"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B655D8DA4BAF38217006FCA56ECD4127"
BuildableName = "SQLite.framework"
BlueprintName = "SQLite.swift"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>