Skip to content

Commit

Permalink
Quiz refinements (#180)
Browse files Browse the repository at this point in the history
* Remove redundant function in AnswerSerializer.

* Clicking highlight selects matching answer inkwell (not just question).

* Nicer margin and border in Quiz review mode.

Add deselectHighlight function on QuizAnswers.

* Increase default max tokens to 10000, in case entire articles selected.
  • Loading branch information
normangilmore authored Nov 23, 2017
1 parent 347ae2c commit ff1b9a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions app/components/Quiz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ export class Quiz extends Component {
dispReview() {
return this.props.currTask.topictree.map((topic, i) => {
return (<div key={topic.id} style={{
"border": "2px solid black",
"border": "2px solid slategray",
"padding": "15px",
"margin": "15px"
"margin": "15px 15px 15px 0px"
}}>
<div> {topic.name} </div>
{ this.mapQuestions(topic.questions) }
Expand Down Expand Up @@ -513,8 +513,8 @@ export class Quiz extends Component {

handleSelect(evt, annotation) {
// Activate the question for this highlight
const question_id = annotation.source.question_id;
this.props.activeQuestion(question_id);
const answer_id = annotation.source.answer_id;
this.props.activeAnswer(answer_id);
let answerState = this.state.answerState;
answerState.selectHighlight(annotation);
this.setState({answerState});
Expand Down
5 changes: 5 additions & 0 deletions app/model/QuizAnswers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class QuizAnswers {
this.hasAnswer = this.hasAnswer.bind(this);
this.getAnswerAnnotations = this.getAnswerAnnotations.bind(this);
this.selectHighlight = this.selectHighlight.bind(this);
this.deselectHighlight = this.deselectHighlight.bind(this);
this.highlightSelected = this.highlightSelected.bind(this);
this.deleteSelection = this.deleteSelection.bind(this);
}
Expand Down Expand Up @@ -69,6 +70,10 @@ export class QuizAnswers {
this._selectedAnnotations.set(annotation.key, annotation);
}

deselectHighlight(annotation) {
this._selectedAnnotations.clear();
}

highlightSelected(annotation_key) {
return this._selectedAnnotations.has(annotation_key);
}
Expand Down
2 changes: 1 addition & 1 deletion researcher/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def get(self, request):
initial = { 'starting_article_id': agg['id__min'],
'ending_article_id': agg['id__max'],
'min_tokens_per_highlight': 1,
'max_tokens_per_highlight': 1000,
'max_tokens_per_highlight': 10000,
'pybossa_url': profile.pybossa_url,
'pybossa_api_key': profile.pybossa_api_key,
'debug_presenter': debug_presenter
Expand Down
5 changes: 0 additions & 5 deletions thresher/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ class Meta:
fields = ('id', 'article_number', 'batch_name', 'text', 'metadata')

class AnswerSerializer(serializers.ModelSerializer):
question_id = serializers.SerializerMethodField()

def get_question_id(self, obj):
return obj.question.id

class Meta:
model = Answer
fields = ('id', 'answer_number', 'answer_content', 'next_questions',
Expand Down

0 comments on commit ff1b9a5

Please sign in to comment.