Skip to content

Commit

Permalink
[Student][R-6.6.1] Fix success/error from file uploads on assignment …
Browse files Browse the repository at this point in the history
…deets (#264)

The submission wasn't getting deleted/errored correctly for file uploads.
  • Loading branch information
CalvinKern authored Aug 26, 2019
1 parent b1c4346 commit 65088dd
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class SubmissionService : IntentService(SubmissionService::class.java.simpleName
}
} catch (e: Throwable) {
detachForegroundNotification()
db.submissionQueries.setSubmissionError(true, submission.id)
showErrorNotification(this@SubmissionService, submission)
return@runBlocking
}
Expand Down Expand Up @@ -190,12 +191,13 @@ class SubmissionService : IntentService(SubmissionService::class.java.simpleName
val attachmentIds = completed.mapNotNull { it.attachmentId } + uploadedAttachmentIds
SubmissionManager.postSubmissionAttachmentsSynchronous(submission.canvasContext.id, submission.assignmentId, attachmentIds)?.let {
// Clear out the db for the successful submission
deleteSubmissionsForAssignment(submission.id, db)
deleteSubmissionsForAssignment(submission.assignmentId, db)

detachForegroundNotification()
showCompleteNotification(this, submission)
} ?: run {
detachForegroundNotification()
db.submissionQueries.setSubmissionError(true, submission.id)
showErrorNotification(this, submission)
}
}
Expand Down Expand Up @@ -586,9 +588,9 @@ class SubmissionService : IntentService(SubmissionService::class.java.simpleName
FileUploadUtils.deleteTempFile(file.fullPath)
}
}
db.fileSubmissionQueries.deleteFilesForSubmissionId(submission.id)
}
db.submissionQueries.deleteSubmissionsForAssignmentId(id, getUserId())
db.fileSubmissionQueries.deleteFilesForSubmissionId(id)
}

// region start helpers
Expand Down

0 comments on commit 65088dd

Please sign in to comment.