Explorar el Código

coursepurpledatum

schtonn hace 1 año
padre
commit
13f9de73e5
Se han modificado 1 ficheros con 12 adiciones y 6 borrados
  1. 12 6
      sdsz74/account.swift

+ 12 - 6
sdsz74/account.swift

@@ -188,6 +188,12 @@ struct PurpleDatum: Codable {
     let data: [FluffyDatum]
 }
 
+extension PurpleDatum {
+    static var coursePurpleDatum = { (course: String) -> PurpleDatum in
+        PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: course, courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil, start: "", end: "", timeScope: 0)])
+    }
+}
+
 // MARK: - FluffyDatum
 
 struct FluffyDatum: Codable {
@@ -342,12 +348,12 @@ func getUserInfo(userInfoIn: UserInfo, action: @escaping (_: UserInfo) -> Void)
                         mx = max(mx, pp[i].lesson)
                     }
                     ret.append([])
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "  ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "一 ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "二 ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "三 ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "四 ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
-                    ret[0].append(PurpleDatum(day: 0, lesson: 0, data: [FluffyDatum(timetableID: nil, className: "", classID: "", courseName: "五 ", courseID: 0, courseType: 0, placeID: nil, placeName: "", placeSn: "", teacher: [], room: nil,  start: "", end: "", timeScope: 0)]))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("  "))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("一 "))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("二 "))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("三 "))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("四 "))
+                    ret[0].append(PurpleDatum.coursePurpleDatum("五 "))
                     for i in 1 ... mx {
                         ret.append([])
                         for j in 0 ... 5 {