diff --git a/apps/teacher/build.gradle b/apps/teacher/build.gradle index 29e9c3c100..9626e86e83 100644 --- a/apps/teacher/build.gradle +++ b/apps/teacher/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { minSdkVersion Versions.MIN_SDK targetSdkVersion Versions.TARGET_SDK - versionCode = 23 + versionCode = 24 versionName = '1.9.0' vectorDrawables.useSupportLibrary = true multiDexEnabled true diff --git a/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderGradeFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderGradeFragment.kt index aa9729616f..79ca77487c 100644 --- a/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderGradeFragment.kt +++ b/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderGradeFragment.kt @@ -79,21 +79,10 @@ class SpeedGraderGradeFragment : BasePresenterFragment() { private var mPostGradeAPICall: Job? = null + private var refreshSubmissionApiCall: Job? = null @Suppress("EXPERIMENTAL_FEATURE_WARNING") fun updateGrade(grade: String, isExcused: Boolean) { @@ -58,6 +59,34 @@ class SpeedGraderGradePresenter(var submission: Submission?, val assignment: Ass } } + fun refreshSubmission() { + refreshSubmissionApiCall = GlobalScope.launch(Dispatchers.Main) { + try { + viewCallback?.onRefreshStarted() + + // Try to update our submission for post/hide grades + val newSubmission = SubmissionManager.getSingleSubmissionAsync( + course.id, + assignment.id, + submission?.userId ?: return@launch, + true + ).await().dataOrNull ?: return@launch + + submission = newSubmission + viewCallback?.updateGradeText() + viewCallback?.onRefreshFinished() + } catch (e: Throwable) { + viewCallback?.updateGradeError() + } + } + } + + override fun onDestroyed() { + super.onDestroyed() + mPostGradeAPICall?.cancel() + refreshSubmissionApiCall?.cancel() + } + override fun loadData(forceNetwork: Boolean) { } override fun refresh(forceNetwork: Boolean) { }