Skip to content

Commit

Permalink
Move history reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent e2c6bcc commit bf2a2de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
11 changes: 3 additions & 8 deletions src/report/reporters/debug/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import { serializeHistograms } from '../../utils/histogram/main.js'

import { getStatsTables } from './stats.js'
import { getTimeSeries } from './time_series.js'

// Debugging reporter only meant for development purpose
const reportTerminal = function ({ combinations, screenWidth, history }) {
const reportTerminal = function ({ combinations, screenWidth }) {
const statsTables = getStatsTables(combinations, screenWidth)
const timeSeries = getTimeSeries(history, combinations, screenWidth)
const histograms = serializeHistograms(combinations, {
mini: true,
screenWidth,
})
return [statsTables, timeSeries, histograms].join('\n\n')
return `${statsTables}\n\n${histograms}`
}

export const debug = {
reportTerminal,
capabilities: { debugStats: true, history: true },
}
export const debug = { reportTerminal, capabilities: { debugStats: true } }
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { isSameDimension } from '../../../combination/ids.js'
import { fieldColor } from '../../utils/colors.js'
import { getCombinationNameColor } from '../../utils/name.js'
import { STATS_SEPARATOR_COLORED } from '../../utils/separator.js'
import { getTables } from '../../utils/table.js'
import { isSameDimension } from '../../combination/ids.js'
import { fieldColor } from '../utils/colors.js'
import { getCombinationNameColor } from '../utils/name.js'
import { STATS_SEPARATOR_COLORED } from '../utils/separator.js'
import { getTables } from '../utils/table.js'

// Show `result.history` as a time series
export const getTimeSeries = function (history, combinations, screenWidth) {
// Show `result.history` as a table
const reportTerminal = function ({ combinations, history, screenWidth }) {
const headerRows = getHeaderRows(history)
const bodyRows = getBodyRows(combinations, history)
return getTables([...headerRows, ...bodyRows], screenWidth)
Expand Down Expand Up @@ -67,3 +67,8 @@ const getCell = function (historyResult, combination) {

return ''
}

export const historyReporter = {
reportTerminal,
capabilities: { history: true },
}
3 changes: 2 additions & 1 deletion src/report/reporters/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { boxplot } from './boxplot/main.js'
import { debug } from './debug/main.js'
import { histogram } from './histogram.js'
import { historyReporter as history } from './history.js'

export const REPORTERS = { debug, boxplot, histogram }
export const REPORTERS = { debug, boxplot, histogram, history }

0 comments on commit bf2a2de

Please sign in to comment.