Skip to content

Commit

Permalink
delete 'all' from relative course graph
Browse files Browse the repository at this point in the history
  • Loading branch information
sasumaki committed Jun 26, 2019
1 parent b086707 commit 96b163d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const getPassRateCumSeriesFromStats = (stats) => {
],
relative: [
// eslint-disable-next-line no-unused-vars
getDataObject(`all`, all.map(_ => 1), 'a'),
getDataObject(`passed`, passed.map(absoluteToRelative(all)), 'b'),
getDataObject(`failed`, failed.map(absoluteToRelative(all)), 'c')
]
Expand Down Expand Up @@ -73,7 +72,6 @@ const getPassRateStudSeriesFromStats = (stats) => {
],
relative: [
// eslint-disable-next-line no-unused-vars
getDataObject(`all`, all.map(_ => 1), 'a'),
getDataObject(` passed on first try`, passedFirst.map(absoluteToRelative(all)), 'b'),
getDataObject(`passed after retry`, passedRetry.map(absoluteToRelative(all)), 'b'),
getDataObject(`failed on first try`, failedFirst.map(absoluteToRelative(all)), 'c'),
Expand All @@ -95,8 +93,8 @@ const PassRate = ({ primary, comparison, viewMode, isRelative = false }) => {

const maxPassRateVal = isRelative ? 1 : getMaxValueOfSeries(passGraphSerie.absolute)
const graphOptionsFn = isCumulativeMode ? passRateCumGraphOptions : passRateStudGraphOptions
const primaryGraphOptions = comparison ? graphOptionsFn(statYears, maxPassRateVal, 'Primary pass rate chart') : graphOptionsFn(statYears, maxPassRateVal, 'Pass rate chart')
const comparisonGraphOptions = graphOptionsFn(statYears, maxPassRateVal, 'Comparison pass rate chart')
const primaryGraphOptions = comparison ? graphOptionsFn(statYears, maxPassRateVal, 'Primary pass rate chart', isRelative) : graphOptionsFn(statYears, maxPassRateVal, 'Pass rate chart', isRelative)
const comparisonGraphOptions = graphOptionsFn(statYears, maxPassRateVal, 'Comparison pass rate chart', isRelative)

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ class SortableTable extends Component {
}
const { tableProps, getRowProps, columns, getRowKey, collapsingHeaders } = this.props
const { selected, direction, collapsed } = this.state
const columnsWithCollapsedHeaders = collapsingHeaders ? [...columns.filter(c => (c.headerProps && (!collapsed.map(cell => cell.headerProps.title).includes(c.headerProps.title) && !c.collapsed))), ...this.state.collapsed].sort((a, b) => a.headerProps.ordernumber - b.headerProps.ordernumber) : columns
const columnsWithCollapsedHeaders = collapsingHeaders ? [...columns.filter(c => (
c.headerProps && (!collapsed.map(cell => cell.headerProps.title).includes(c.headerProps.title) && !c.collapsed))),
...this.state.collapsed].sort((a, b) => a.headerProps.ordernumber - b.headerProps.ordernumber)
:
columns

const sortDirection = name => (selected === name ? direction : null)

return (
Expand Down
8 changes: 4 additions & 4 deletions services/oodikone2-frontend/src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export const API_DATE_FORMAT = 'YYYY.MM.DD'

export const TOKEN_NAME = window.location.pathname.includes('staging') ? 'staging_token' : window.location.pathname.includes('/testing') ? 'testing_token' : 'token' //eslint-disable-line

export const passRateCumGraphOptions = (categories, max, title) => ({
export const passRateCumGraphOptions = (categories, max, title, skipFirstColor) => ({
chart: {
type: 'column'
},
colors: [chartblue, green, red],
colors: skipFirstColor ? [green, red] : [chartblue, green, red],

title: {
text: title
Expand All @@ -119,11 +119,11 @@ export const passRateCumGraphOptions = (categories, max, title) => ({
}
})

export const passRateStudGraphOptions = (categories, max, title) => ({
export const passRateStudGraphOptions = (categories, max, title, skipFirstColor) => ({
chart: {
type: 'column'
},
colors: [chartblue, chartlgreen, chartdarkg, chartlred, chartdarkred],
colors: skipFirstColor ? [chartlgreen, chartdarkg, chartlred, chartdarkred] : [chartblue, chartlgreen, chartdarkg, chartlred, chartdarkred],

title: {
text: title
Expand Down

0 comments on commit 96b163d

Please sign in to comment.