Clean up code

This commit is contained in:
Ramon Wenger 2020-02-06 15:06:50 +01:00
parent c4cacac1c7
commit d11d494fae
3 changed files with 18 additions and 15 deletions

View File

@ -22,8 +22,7 @@
parts.push({
correct: true,
text: this.text.substring(index, realOffset)
});
parts.push({
}, {
correct: false,
text: this.text.substring(realOffset, realOffset + current.length)
});

View File

@ -16,9 +16,10 @@
@click="$emit('turnIn')"
>{{action}}
</button>
<button class="submission-form-container__submit submission-form-container__spellcheck button button--primary button--white-bg"
v-if="spellcheck"
@click="$emit('spellcheck')"
<button
class="submission-form-container__submit submission-form-container__spellcheck button button--primary button--white-bg"
v-if="spellcheck"
@click="$emit('spellcheck')"
>Rechtschreibung prüfen
</button>
<div v-if="userInput.document">
@ -53,13 +54,6 @@
import DocumentBlock from '@/components/content-blocks/DocumentBlock';
export default {
components: {
SubmissionInput,
FinalSubmission,
SimpleFileUpload,
DocumentBlock
},
props: {
userInput: Object,
saved: Boolean,
@ -68,12 +62,19 @@
reopen: Function,
document: String,
spellcheck: {
tyoe: Boolean,
type: Boolean,
default: false
},
sharedMsg: String
},
components: {
SubmissionInput,
FinalSubmission,
SimpleFileUpload,
DocumentBlock
},
computed: {
final() {
return !!this.userInput && this.userInput.final

View File

@ -7,6 +7,9 @@ import requests
# client = TaskbaseClient('info@iterativ.ch', 'myverysafepassword1234', 'https://dev-iterativ.taskbase.com')
# client.spellcheck('aOciP9H7tNu7pLsR4ohllk', 'Dies ist ein Sats mit filen Felern')
class TaskbaseException(Exception):
pass
class TaskbaseClient:
# def __init__(self, resource_url):
# # resource url should be in the form https://username:password@baseurl
@ -59,9 +62,9 @@ class TaskbaseClient:
headers=headers)
if response.status_code != 200:
raise Exception('Something went wrong')
raise TaskbaseException('Something went wrong')
else: # todo: define what to do here
raise Exception('Something went wrong')
raise TaskbaseException('Something went wrong')
def spellcheck(self, task, text):
if self.token is None: