Skip to content

Commit

Permalink
Merge branch 'master' into release/teacher
Browse files Browse the repository at this point in the history
  • Loading branch information
hermannakos authored May 25, 2021
2 parents 7031dd7 + 8853857 commit d83bcd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ import androidx.viewpager.widget.ViewPager
import com.instructure.canvasapi2.StatusCallback
import com.instructure.canvasapi2.managers.ModuleManager
import com.instructure.canvasapi2.models.*
import com.instructure.canvasapi2.utils.ApiType
import com.instructure.canvasapi2.utils.LinkHeaders
import com.instructure.canvasapi2.utils.Logger
import com.instructure.canvasapi2.utils.isRtl
import com.instructure.canvasapi2.utils.*
import com.instructure.canvasapi2.utils.weave.WeaveJob
import com.instructure.canvasapi2.utils.weave.awaitApi
import com.instructure.canvasapi2.utils.weave.catch
Expand Down Expand Up @@ -325,7 +322,7 @@ class CourseModuleProgressionFragment : ParentFragment(), Bookmarkable {
markDoneWrapper.setGone()
} else {
val completionRequirement = item.completionRequirement
if (completionRequirement != null && ModuleItem.MUST_MARK_DONE == completionRequirement.type) {
if (completionRequirement != null && ModuleItem.MUST_MARK_DONE == completionRequirement.type && !item.isLocked()) {
markDoneWrapper.setVisible()
markDoneCheckbox.isChecked = completionRequirement.completed
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fun Course.isCreationPending(): Boolean = enrollments?.any { it.enrollmentState
fun Course.isNotDeleted(): Boolean = workflowState != Course.WorkflowState.DELETED
fun Course.isPublished(): Boolean = workflowState != Course.WorkflowState.UNPUBLISHED

fun ModuleItem.isLocked(): Boolean = moduleDetails?.lockedForUser ?: false || moduleDetails?.lockExplanation.isValid() && moduleDetails?.lockDate?.before(Date()) == true && moduleDetails.unlockDate?.after(Date()) == true

fun MediaComment.asAttachment() = Attachment().also {
it.contentType = contentType ?: ""
it.displayName = displayName
Expand Down

0 comments on commit d83bcd9

Please sign in to comment.