Archived
Added line break recognition to info table, added new card displayed when the general plan is empty
This commit is contained in:
@@ -167,6 +167,7 @@ class DataFetcher {
|
|||||||
foodUrl = "https://djd4rkn355.github.io/food_test.html"
|
foodUrl = "https://djd4rkn355.github.io/food_test.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isPlanEmpty = true
|
||||||
var isPersonalEmpty = true
|
var isPersonalEmpty = true
|
||||||
var personalPlanCount = 0
|
var personalPlanCount = 0
|
||||||
var mWebsitePriority = 0
|
var mWebsitePriority = 0
|
||||||
@@ -188,6 +189,7 @@ class DataFetcher {
|
|||||||
let coursePreference = prefs.string(forKey: "courses")
|
let coursePreference = prefs.string(forKey: "courses")
|
||||||
|
|
||||||
for i in (0..<rows.size()) {
|
for i in (0..<rows.size()) {
|
||||||
|
isPlanEmpty = false
|
||||||
let cols = try rows.get(i).select("th")
|
let cols = try rows.get(i).select("th")
|
||||||
|
|
||||||
let mGroup = try cols.get(0).text()
|
let mGroup = try cols.get(0).text()
|
||||||
@@ -228,6 +230,11 @@ class DataFetcher {
|
|||||||
|
|
||||||
prefs.set(personalPlanCount, forKey: "personalPlanCount")
|
prefs.set(personalPlanCount, forKey: "personalPlanCount")
|
||||||
|
|
||||||
|
if isPlanEmpty {
|
||||||
|
let emptySubstitution = SubstModel(group: "", course: NSLocalizedString("plan_empty", comment: ""), additional: "", date: "", time: "", room: "", teacher: "", type: "", groupPriority: 0, datePriority: 0, websitePriority: 0)
|
||||||
|
substitutionList.append(emptySubstitution)
|
||||||
|
}
|
||||||
|
|
||||||
if isPersonalEmpty {
|
if isPersonalEmpty {
|
||||||
let emptySubstitution = SubstModel(group: "", course: NSLocalizedString("personal_plan_empty", comment: ""), additional: "", date: "", time: "", room: "", teacher: "", type: "", groupPriority: 0, datePriority: 0, websitePriority: 0)
|
let emptySubstitution = SubstModel(group: "", course: NSLocalizedString("personal_plan_empty", comment: ""), additional: "", date: "", time: "", room: "", teacher: "", type: "", groupPriority: 0, datePriority: 0, websitePriority: 0)
|
||||||
personalList.append(emptySubstitution)
|
personalList.append(emptySubstitution)
|
||||||
@@ -238,10 +245,10 @@ class DataFetcher {
|
|||||||
|
|
||||||
let lastUpdated = try substitutionsDocument.select("h1").get(0).text()
|
let lastUpdated = try substitutionsDocument.select("h1").get(0).text()
|
||||||
infoString = "\(NSLocalizedString("last_updated", comment: ""))\(lastUpdated)."
|
infoString = "\(NSLocalizedString("last_updated", comment: ""))\(lastUpdated)."
|
||||||
let informationTableElements = try substitutionsDocument.select("p")
|
let informationTableElements = try substitutionsDocument.select("h6")
|
||||||
|
|
||||||
for item in informationTableElements {
|
for item in informationTableElements {
|
||||||
infoString += "\n\n\(try item.text())"
|
infoString += "\n\n\(try item.html().replacingOccurrences(of: "<br>", with: "\n"))"
|
||||||
}
|
}
|
||||||
|
|
||||||
// start food fetch
|
// start food fetch
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
"pinkA" = "Pink (Android)";
|
"pinkA" = "Pink (Android)";
|
||||||
"brownA" = "Braun (Android)";
|
"brownA" = "Braun (Android)";
|
||||||
|
|
||||||
|
"plan_empty" = "Der Vertretungsplan ist leer";
|
||||||
"personal_plan_empty" = "Dein Plan ist leer :(";
|
"personal_plan_empty" = "Dein Plan ist leer :(";
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
"pinkA" = "Pink (Android)";
|
"pinkA" = "Pink (Android)";
|
||||||
"brownA" = "Brown (Android)";
|
"brownA" = "Brown (Android)";
|
||||||
|
|
||||||
|
"plan_empty" = "The substitution plan is empty";
|
||||||
"personal_plan_empty" = "Your plan is empty :(";
|
"personal_plan_empty" = "Your plan is empty :(";
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
|
|||||||
Reference in New Issue
Block a user