Skip to content

Commit

Permalink
* In this branch we're marking instances of TODO_V2_IMPORT with indic…
Browse files Browse the repository at this point in the history
…ations of what should be done to address the issue. All relate to properties that are present in V2 documents that have not yet been brought into the V3 document model. About 7 stories have been created based on these markers. But the remainder are all in codap-v2-types.ts and can be dealt with in situ. Here is a rough classification.

  * Properties that were present briefly in V2 documents but are no longer used. These can be ignored in the V3 import.
  * Properties that are also present in V3 and which refer to implemented features, but the carrying them over during the input process has not yet been brought about.
  * Properties present in the V3 model which do not yet have an implementation.
  * Properties not present in V3 but where the feature is present but defined differently. An example of this is `transparency` referring to the opacity of a graph point where this is stored as a separate property in V2 but is an intrinsic part of the `fill` of a point in V3.
  * Properties referring to a feature present in V2 but which is not yet implemented in V3.
  • Loading branch information
bfinzer committed Dec 18, 2024
1 parent 601334e commit 474bc2d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions v3/src/components/graph/adornments/v2-adornment-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ interface IInstanceKeysForAdornmentsProps {
}

const univariateMeasureInstances = (adornment: ICodapV2UnivariateAdornment, instanceKeys?: string[]) => {
// TODO_V2_IMPORT: most documents with an equationCoordsArray have multiple items in the array
// TODO_V2_IMPORT: [Story **#188695360**] most documents with an equationCoordsArray have multiple items in the array
// we are only looking at the first item here
const equationCoordsV2 = adornment.equationCoordsArray?.[0]

// TODO_V2_IMPORT: 93 files in cfm-shared have equationCoordsArray with values with
// TODO_V2_IMPORT: [Story: **#188695677**] 93 files in cfm-shared have equationCoordsArray with values with
// proportionCenterX and proportionCenterY instead of proportionX and proportionY.
// For now we are just skipping those and treating them as undefined
// example doc: cfm-shared/1caDhoHFlpuNQgSfOdhh/file.json
Expand Down Expand Up @@ -223,7 +223,7 @@ export const v2AdornmentImporter = ({data, plotModels, attributeDescriptions, yA
const lines: Record<string, IMovableLineInstanceSnapshot> = {}
instanceKeys?.forEach((key: string) => {
const lineInstance = {
// TODO_V2_IMPORT: equationCoords are not handled correctly, the model stores x and y
// TODO_V2_IMPORT: [Story: **#188695677**] equationCoords are not handled correctly, the model stores x and y
// but the loaded equationCoords have proportionCenterX and proportionCenterY
equationCoords: equationCoords ?? undefined, // The V2 default is null, but we want undefined
intercept: movableLineAdornment.intercept,
Expand All @@ -249,7 +249,7 @@ export const v2AdornmentImporter = ({data, plotModels, attributeDescriptions, yA
const lsrlInstances: ILSRLInstanceSnapshot[] = []
lsrlAdornment.lsrls?.forEach((lsrl) => {
const lsrlInstance = {
// TODO_V2_IMPORT: equationCoords are not handled correctly, the model stores x and y
// TODO_V2_IMPORT: [Story: **#188695677**] equationCoords are not handled correctly, the model stores x and y
// but the loaded equationCoords have proportionCenterX and proportionCenterY
equationCoords: lsrl.equationCoords ?? undefined // The V2 default is null, but we want undefined
}
Expand Down Expand Up @@ -377,7 +377,7 @@ export const v2AdornmentImporter = ({data, plotModels, attributeDescriptions, yA
plotValues.push(value.value)
})

// TODO_V2_IMPORT: both valueModels and values might have `isVisible: false`
// [Story: #188699857] TODO_V2_IMPORT: both valueModels and values might have `isVisible: false`
// we are currently just ignoring that
values[key] = plotValues
})
Expand Down
5 changes: 3 additions & 2 deletions v3/src/components/graph/v2-graph-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function v2GraphImporter({v2Component, v2Document, sharedModelManager, in
pointColor, strokeColor, pointSizeMultiplier,
strokeSameAsFill, isTransparent,
plotBackgroundImageLockInfo,
/* TODO_V2_IMPORT: The following are present in the componentStorage but not used in the V3 content model (yet):
/* TODO_V2_IMPORT: [Story: #188694812]
The following are present in the componentStorage but not used in the V3 content model (yet):
displayOnlySelected, legendRole, legendAttributeType, numberOfLegendQuantiles,
legendQuantilesAreLocked, plotBackgroundImage, transparency, strokeTransparency,
plotBackgroundOpacity,
Expand Down Expand Up @@ -132,7 +133,7 @@ export function v2GraphImporter({v2Component, v2Document, sharedModelManager, in
axes[v3Place] = {place: v3Place, type: "categorical"}
break
case "DG.CellLinearAxisModel":
// TODO_V2_IMPORT when lowerBound or upperBound are undefined or null this is
// TODO_V2_IMPORT [Story:#188701144] when lowerBound or upperBound are undefined or null this is
// not handled correctly. It likely will cause an MST exception and failure to load.
// There are 966 instances of `xUpperBound: null` in cfm-shared
axes[v3Place] = {place: v3Place, type: "numeric", min: lowerBound as any, max: upperBound as any}
Expand Down
6 changes: 3 additions & 3 deletions v3/src/components/map/v2-map-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function v2MapImporter({v2Component, v2Document, insertTile}: V2TileImpor
const {
pointColor, strokeColor, pointSizeMultiplier,
grid, pointsShouldBeVisible, connectingLines
/* TODO_V2_IMPORT: Present in v2 layer model but not yet used in V3 layer model:
/* TODO_V2_IMPORT: [Story: #188694812] Present in v2 layer model but not yet used in V3 layer model:
transparency, strokeTransparency
*/
} = v2LayerModel
Expand All @@ -81,7 +81,7 @@ export function v2MapImporter({v2Component, v2Document, insertTile}: V2TileImpor
dataset: data?.dataSet.id,
metadata: metadata?.id,
_attributeDescriptions,
// TODO_V2_IMPORT hiddenCases are not imported
// TODO_V2_IMPORT [Story: #188694826] hiddenCases are not imported
// the array in a "modern" v2 document coming from `mapModelStorage.layerModels[]._links_.hiddenCases`
// looks like { type: "DG.Case", id: number }
// The MST type expects an array of strings.
Expand All @@ -106,7 +106,7 @@ export function v2MapImporter({v2Component, v2Document, insertTile}: V2TileImpor
else if (isV2MapPolygonLayerStorage(v2LayerModel)) {
const {
areaColor, areaStrokeColor,
/* TODO_V2_IMPORT: Present in v2 layer model but not yet used in V3 layer model:
/* TODO_V2_IMPORT: [Story: #188694812] Present in v2 layer model but not yet used in V3 layer model:
areaTransparency, areaStrokeTransparency
*/
} = v2LayerModel
Expand Down
3 changes: 2 additions & 1 deletion v3/src/v2/codap-v2-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ export class CodapV2Document {

registerContexts(contexts?: CodapV2Context[]) {
contexts?.forEach(context => {
// TODO_V2_IMPORT: external contexts are not imported
// TODO_V2_IMPORT_IGNORE: external contexts are not imported
// There are 75 cases of external contexts in cfm-shared
// This refers to an obsolescent form of document storage no longer used at all. Ignore!
if (isV2ExternalContext(context)) return
const { guid, type = "DG.DataContext", document, name = "", title, collections = [] } = context
if (document && this.guidMap.get(document)?.type !== "DG.Document") {
Expand Down
2 changes: 1 addition & 1 deletion v3/src/v2/codap-v2-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ICodapV2Attribute {
deletedFormula?: string
precision?: number | string | null
unit?: string | null
// TODO_V2_IMPORT decimals is not imported
// TODO_V2_IMPORT [Story:#188701222] decimals is not imported
// it occurs 604 times in 36 files in cfm-shared
// in 33 cases the value is "2"
// the rest of the cases the value is "0"
Expand Down

0 comments on commit 474bc2d

Please sign in to comment.