Archived
Changed test URLs to read URLs, added string for empty personal plan
This commit is contained in:
@@ -34,8 +34,8 @@ class DataFetcher {
|
|||||||
|
|
||||||
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: [Any]) -> ()) {
|
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: [Any]) -> ()) {
|
||||||
DispatchQueue(label: "work-queue").async {
|
DispatchQueue(label: "work-queue").async {
|
||||||
let foodUrl = "https://djd4rkn355.github.io/food_test.html"
|
let foodUrl = "https://djd4rkn355.github.io/food.html"
|
||||||
let url = "https://djd4rkn355.github.io/subst_test.html"
|
let url = "https://djd4rkn355.github.io/subst.html"
|
||||||
Alamofire.request(url).responseString { response in
|
Alamofire.request(url).responseString { response in
|
||||||
if let html = response.result.value {
|
if let html = response.result.value {
|
||||||
Alamofire.request(foodUrl).responseString { response in
|
Alamofire.request(foodUrl).responseString { response in
|
||||||
@@ -54,6 +54,7 @@ class DataFetcher {
|
|||||||
var info = ""
|
var info = ""
|
||||||
var infoList = [String]()
|
var infoList = [String]()
|
||||||
var menuList = [String]()
|
var menuList = [String]()
|
||||||
|
var isPersonalEmpty = true
|
||||||
do {
|
do {
|
||||||
let doc = try SwiftSoup.parse(html)
|
let doc = try SwiftSoup.parse(html)
|
||||||
|
|
||||||
@@ -112,6 +113,7 @@ class DataFetcher {
|
|||||||
let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional,
|
let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional,
|
||||||
date <- mDate, time <- mTime, room <- mRoom)
|
date <- mDate, time <- mTime, room <- mRoom)
|
||||||
_ = try db.run(insertPersonal)
|
_ = try db.run(insertPersonal)
|
||||||
|
isPersonalEmpty = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if courses != nil && courses != "" && classes != nil && classes != "" {
|
} else if courses != nil && courses != "" && classes != nil && classes != "" {
|
||||||
@@ -123,6 +125,7 @@ class DataFetcher {
|
|||||||
let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional,
|
let insertPersonal = personal.insert(group <- mGroup, course <- mCourse, additional <- mAdditional,
|
||||||
date <- mDate, time <- mTime, room <- mRoom)
|
date <- mDate, time <- mTime, room <- mRoom)
|
||||||
_ = try db.run(insertPersonal)
|
_ = 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")
|
let pi: Elements = try doc.select("p")
|
||||||
|
|
||||||
for item in pi {
|
for item in pi {
|
||||||
|
|||||||
+71
@@ -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>
|
||||||
Reference in New Issue
Block a user