From e91195304affcaed66beb82d876ebc9b001e1829 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Wed, 28 Nov 2018 16:10:39 +0000 Subject: [PATCH 1/2] TaskInputField: remove annotation prop Remove unused annotation prop from multiple choice and single answer tasks. --- app/classifier/tasks/multiple/index.jsx | 1 - app/classifier/tasks/single/index.jsx | 1 - 2 files changed, 2 deletions(-) diff --git a/app/classifier/tasks/multiple/index.jsx b/app/classifier/tasks/multiple/index.jsx index cbef3f8294..8e51d73f92 100644 --- a/app/classifier/tasks/multiple/index.jsx +++ b/app/classifier/tasks/multiple/index.jsx @@ -34,7 +34,6 @@ export default class MultipleChoiceTask extends React.Component { answers.push( Date: Wed, 28 Nov 2018 16:12:08 +0000 Subject: [PATCH 2/2] Remove annotation prop from drawing tools Remove unused annotation prop from task input field. Clean up the code that renders the drawing tool choices to make it more readable. --- app/classifier/tasks/drawing/index.cjsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/classifier/tasks/drawing/index.cjsx b/app/classifier/tasks/drawing/index.cjsx index 26ab63210c..248acb4b2a 100644 --- a/app/classifier/tasks/drawing/index.cjsx +++ b/app/classifier/tasks/drawing/index.cjsx @@ -92,17 +92,17 @@ module.exports = createReactClass annotation: null onChange: Function.prototype - render: -> - tools = for tool, i in @props.task.tools + tools: -> + @props.task.tools.map (tool, i) => tool._key ?= Math.random() - count = (true for mark in @props.annotation.value when mark.tool is i).length + marksByType = @props.annotation.value.filter (mark) -> mark.tool is i + count = marksByType.length translation = @props.translation.tools[i] - checked = i is (@props.annotation._toolIndex ? 0) + checked = i is (@props.annotation._toolIndex ? 0)
}
+ render: ->