-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add badges view * Add exam button * Fix units access * Add ExamSession & ProctorSession models * Handle exam can start state * Handle other states * Clean up get state * Fetch sessions * Fix progressLabelText * Handle exam button clicked
- Loading branch information
1 parent
869860a
commit b98a3c6
Showing
41 changed files
with
1,921 additions
and
84 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ges.xcassets/Course info syllabus/course-info-syllabus-in-progress.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "course-info-syllabus-in-progress.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+1.77 KB
...o syllabus/course-info-syllabus-in-progress.imageset/course-info-syllabus-in-progress.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions
15
Stepic/Images.xcassets/Course info syllabus/course-info-syllabus-time.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "course-info-syllabus-time.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true | ||
} | ||
} |
Binary file added
BIN
+1.6 KB
...ets/Course info syllabus/course-info-syllabus-time.imageset/course-info-syllabus-time.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
Stepic/Legacy/Model/Entities/ExamSession/ExamSession+CoreDataProperties.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import CoreData | ||
import Foundation | ||
|
||
extension ExamSession { | ||
@NSManaged var managedId: NSNumber? | ||
@NSManaged var managedUserId: NSNumber? | ||
@NSManaged var managedSectionId: NSNumber? | ||
@NSManaged var managedBeginDate: Date? | ||
@NSManaged var managedEndDate: Date? | ||
@NSManaged var managedTimeLeft: NSNumber? | ||
|
||
@NSManaged var managedSection: Section? | ||
|
||
static var oldEntity: NSEntityDescription { | ||
NSEntityDescription.entity(forEntityName: "ExamSession", in: CoreDataHelper.shared.context)! | ||
} | ||
|
||
static var fetchRequest: NSFetchRequest<ExamSession> { | ||
NSFetchRequest<ExamSession>(entityName: "ExamSession") | ||
} | ||
|
||
convenience init() { | ||
self.init(entity: Self.oldEntity, insertInto: CoreDataHelper.shared.context) | ||
} | ||
|
||
var id: Int { | ||
get { | ||
self.managedId?.intValue ?? -1 | ||
} | ||
set { | ||
self.managedId = NSNumber(value: newValue) | ||
} | ||
} | ||
|
||
var userId: Int { | ||
get { | ||
self.managedUserId?.intValue ?? -1 | ||
} | ||
set { | ||
self.managedUserId = NSNumber(value: newValue) | ||
} | ||
} | ||
|
||
var sectionId: Int { | ||
get { | ||
self.managedSectionId?.intValue ?? -1 | ||
} | ||
set { | ||
self.managedSectionId = NSNumber(value: newValue) | ||
} | ||
} | ||
|
||
var beginDate: Date? { | ||
get { | ||
self.managedBeginDate | ||
} | ||
set { | ||
self.managedBeginDate = newValue | ||
} | ||
} | ||
|
||
var endDate: Date? { | ||
get { | ||
self.managedEndDate | ||
} | ||
set { | ||
self.managedEndDate = newValue | ||
} | ||
} | ||
|
||
var timeLeft: Float { | ||
get { | ||
self.managedTimeLeft?.floatValue ?? 0 | ||
} | ||
set { | ||
self.managedTimeLeft = NSNumber(value: newValue) | ||
} | ||
} | ||
|
||
var section: Section? { | ||
get { | ||
self.managedSection | ||
} | ||
set { | ||
self.managedSection = newValue | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
Stepic/Legacy/Model/Entities/ExamSession/ExamSession.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import CoreData | ||
import Foundation | ||
import SwiftyJSON | ||
|
||
final class ExamSession: NSManagedObject, JSONSerializable, IDFetchable { | ||
typealias IdType = Int | ||
|
||
var isActive: Bool { self.timeLeft > 0 } | ||
|
||
required convenience init(json: JSON) { | ||
self.init() | ||
self.initialize(json) | ||
} | ||
|
||
func initialize(_ json: JSON) { | ||
self.id = json[JSONKey.id.rawValue].intValue | ||
self.userId = json[JSONKey.user.rawValue].intValue | ||
self.sectionId = json[JSONKey.section.rawValue].intValue | ||
self.beginDate = Parser.dateFromTimedateJSON(json[JSONKey.beginDate.rawValue]) | ||
self.endDate = Parser.dateFromTimedateJSON(json[JSONKey.endDate.rawValue]) | ||
self.timeLeft = json[JSONKey.timeLeft.rawValue].floatValue | ||
} | ||
|
||
func update(json: JSON) { | ||
self.initialize(json) | ||
} | ||
|
||
enum JSONKey: String { | ||
case id | ||
case user | ||
case section | ||
case beginDate = "begin_date" | ||
case endDate = "end_date" | ||
case timeLeft = "time_left" | ||
} | ||
} |
Oops, something went wrong.