Skip to content

Commit

Permalink
clean up some code in Expression.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkrives committed Oct 8, 2018
1 parent e5906fe commit 493b997
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions modules/gob-web/modules/area-of-study/expression.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
// @flow

import * as React from 'react'
import cx from 'classnames'
import CourseExpression from './expression--course'
import ResultIndicator from './result-indicator'

import type {
Qualifier,
Qualification,
QualificationValue,
} from '@gob/examine-student'

import has from 'lodash/has'
import plur from 'plur'
import {humanizeOperator} from '@gob/examine-student'
import debug from 'debug'
const log = debug('web:react')

import type {Course} from '@gob/types'

Expand Down Expand Up @@ -194,7 +190,7 @@ export default function Expression(props: Props) {

const computationResult = expr._result
const isFulfillment = expr._isFulfillment
const wasUsed = has(expr, '_result') && computationResult
const wasUsed = Boolean(expr._result)
const wasTaken = expr._taken
const wasEvaluated = expr._checked

Expand Down Expand Up @@ -227,19 +223,18 @@ export default function Expression(props: Props) {
} else if ($type === 'occurrence') {
;({description, contents} = makeOccurrenceExpression(props))
} else {
log(`<Expression />: type not handled: ${$type}`)
log(props)
console.warn(`<Expression />: type not handled: ${$type}`, props)
contents = JSON.stringify(expr, null, 2)
}

const className = [
const className = cx([
'expression',
`expression--${$type}`,
wasEvaluated ? 'evaluated' : 'not-evaluated',
isFulfillment ? 'fulfillment' : '',
wasTaken ? 'taken' : 'not-taken',
wasUsed ? 'used' : 'not-used',
].join(' ')
])

return (
<span className={className}>
Expand Down

0 comments on commit 493b997

Please sign in to comment.