Skip to content

Commit

Permalink
Add rating range to score name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Ord committed Oct 10, 2023
1 parent a579ef1 commit abc3063
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/common/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { z } from 'zod'

export const currentVersion = '17'

export const scoreName = 'Quality'
export const scoreName = 'Quality (0-5)'

const infoSchema = z.object({
name: z.string(),
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/common/util/converters/converters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ describe('converters', () => {
{ type: 'numeric', name: 'Hvedemel', value: 632 },
{ type: 'categorical', name: 'Kunde', value: 'Mus' },
{ type: 'score', name: scoreName, value: 0.1 },
{ type: 'score', name: scoreName + '2', value: 0.3 },
{ type: 'score', name: scoreName + ' 2', value: 0.3 },
] satisfies DataPointType[],
[
{ type: 'numeric', name: 'Sukker', value: 15 },
{ type: 'numeric', name: 'Peber', value: 123 },
{ type: 'numeric', name: 'Hvedemel', value: 324 },
{ type: 'categorical', name: 'Kunde', value: 'Ræv' },
{ type: 'score', name: scoreName, value: 0.2 },
{ type: 'score', name: scoreName + '2', value: 0.4 },
{ type: 'score', name: scoreName + ' 2', value: 0.4 },
] satisfies DataPointType[],
].map((data, idx) => ({
meta: { enabled: true, id: idx + 1, valid: true },
Expand Down Expand Up @@ -248,7 +248,7 @@ describe('converters', () => {
sampleExperiment.valueVariables,
[
{ name: scoreName, description: '', enabled: true },
{ name: scoreName + '2', description: '', enabled: true },
{ name: scoreName + ' 2', description: '', enabled: true },
],
sampleMultiObjectiveDataPoints
)
Expand All @@ -265,7 +265,7 @@ describe('converters', () => {
sampleExperiment.valueVariables,
[
{ name: scoreName, description: '', enabled: true },
{ name: scoreName + '2', description: '', enabled: false },
{ name: scoreName + ' 2', description: '', enabled: false },
],
sampleMultiObjectiveDataPoints
)
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/common/util/migration/data-formats/17.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
],
"scoreVariables": [
{
"name": "Quality",
"description": "Quality",
"name": "Quality (0-5)",
"description": "Quality (0-5)",
"enabled": true
}
],
Expand Down Expand Up @@ -90,7 +90,7 @@
},
{
"type": "score",
"name": "Quality",
"name": "Quality (0-5)",
"value": 0.5
}
]
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/util/migration/migration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe('Migration of data format', () => {
enabled: scoreVariables[0]?.enabled,
},
{
name: scoreName + '2',
name: scoreName + ' 2',
description: scoreName,
enabled: scoreVariables[1]?.enabled,
},
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('Migration of data format', () => {
? [
{
type: 'score',
name: scoreName + '2',
name: scoreName + ' 2',
value: 2,
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const migrateToV17 = (json: ExperimentType): ExperimentType => {
return produce(json, draft => {
draft.info.dataFormatVersion = '17'
draft.scoreVariables = json.scoreVariables.map((s, i) => ({
name: scoreName + (i > 0 ? i + 1 : ''),
name: scoreName + (i > 0 ? ` ${i + 1}` : ''),
description: scoreName,
enabled: s.enabled,
}))
Expand All @@ -14,7 +14,7 @@ export const migrateToV17 = (json: ExperimentType): ExperimentType => {
data: dp.data.map(d => ({
...d,
//replaces 'score' with scoreName and keeps the '2' when multiobjective
name: d.name.replace('score', scoreName),
name: d.name.replace('score', scoreName + ' ').trim(),
})),
}))
})
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/features/result-data/single-data-point.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import useStyles from './single-data-point.style'
import { PNGPlot } from '@boostv/process-optimizer-frontend-plots'
import { useState } from 'react'
import { scoreName } from '@boostv/process-optimizer-frontend-core'

interface SingleDataPointProps {
title: string
Expand Down Expand Up @@ -46,7 +47,7 @@ export const SingleDataPoint = ({
<TableHead>
<TableRow>
{headers
.concat(['Score (95 % credibility interval)'])
.concat([scoreName + ' (95 % credibility interval)'])
.map((h, idx) => (
<TableCell className={classes.cell} key={idx}>
{h}
Expand Down

0 comments on commit abc3063

Please sign in to comment.