Skip to content

Conversation

@kvld
Copy link
Contributor

@kvld kvld commented Apr 26, 2018

Задача: #APPS-1871

Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Добавили переход к последнему пройденному шагу после записи на курс

Описание:
Вместо презентации секций используем везде после записи LastStepRouter. На странице "о курсе" теперь используется CourseSubscriber.

@kvld kvld added the main label Apr 26, 2018
@kvld kvld added this to the 1.58 milestone Apr 26, 2018
@kvld kvld self-assigned this Apr 26, 2018
@kvld kvld requested a review from Ostrenkiy April 26, 2018 11:45
class SectionsAPI: APIEndpoint {
override var name: String { return "sections" }

func retrieve(ids: [Int], existing: [Section], headers: [String: String] = AuthInfo.shared.initialHTTPHeaders) -> Promise<[Section]> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем тут headers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Видимо незачем после рефакторинга? Сигнатуру взял из какого-то другого класса с API.


guard let unitId = course.lastStep?.unitId else {
openSyllabus()
// If last step does not exists then take first section and its first unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exists -> exist, опечатка

if let stepId = course.lastStep?.stepId {
fulfill(stepId)
} else {
let cachedLesson = Lesson.getLesson(unit.lessonId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Думаю, здесь лучше будет выглядеть cachedLesson = unit.lesson

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Давай здесь все-таки сделаем что-то вроде let cachedLesson = unit.lesson ?? Lesson.getlesson(unit.lessonId)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Готово!

let cachedLesson = Lesson.getLesson(unit.lessonId)
ApiDataDownloader.lessons.retrieve(ids: [unit.lessonId], existing: cachedLesson == nil ? [] : [cachedLesson!]).then { lesson -> Void in
if let firstStepId = lesson.first?.stepsArray.first {
fulfill(firstStepId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А здесь хорошо было бы присвоить unit.lesson = lesson

@kvld kvld merged commit 9e60407 into dev Apr 27, 2018
@kvld kvld deleted the feature/first-step-continue branch April 27, 2018 15:06
@Ostrenkiy Ostrenkiy mentioned this pull request May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants