Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: hide grades when sub section dependents not available #99

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

saeedbashir
Copy link

@saeedbashir saeedbashir commented Nov 28, 2024

Description

LEARNER-10266

Hide the mid-term exam grading when descents aren't available and remove some warnings those were appearing in the file.

Before After
Simulator Screenshot - iPhone 16 Pro - 2024-11-28 at 11 14 46 Simulator Screenshot - iPhone 16 Pro - 2024-11-28 at 10 41 59

private func canDownloadAllSections(in chapter: CourseChapter) -> Bool {
for sequential in chapter.childs {
if let state = viewModel.sequentialsDownloadState[sequential.id] {
if let _ = viewModel.sequentialsDownloadState[sequential.id] {

Choose a reason for hiding this comment

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

If we refactor it something like this:

    private func canDownloadAllSections(in chapter: CourseChapter) -> Bool {
        for sequential in chapter.childs where viewModel.sequentialsDownloadState[sequential.id] != nil {
            return true
        }
        return false
    }

Then we can avoid following two warnings:

Unused Optional Binding Violation: Prefer `!= nil` over `let _ =` (unused_optional_binding)

Prefer For-Where Violation: `where` clauses are preferred over a single `if` inside a `for` (for_where)

Copy link

@shafqat-muneer shafqat-muneer left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@saeedbashir saeedbashir merged commit e9c4928 into 2U/develop Nov 29, 2024
2 checks passed
@saeedbashir saeedbashir deleted the saeed/LEARNER-10266 branch November 29, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants