Skip to content

Commit

Permalink
Merge branch 'student-trigatti'
Browse files Browse the repository at this point in the history
  • Loading branch information
Miccighel committed Sep 23, 2024
2 parents 09f957b + 52f3666 commit 187d268
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export class DimensionComponent implements OnInit, OnChanges {
public detectCategoricalDimensionOnChange(eventData: { value?: any; target?: any; }) {
if (this.task.settings.attributesMain.some(attribute => attribute.is_video) &&
this.task.dimensions.some(dimension => dimension.scale.type == "interval") &&
this.task.dimensions.filter(dimension => dimension.scale.type == "categorical").length > 1) {
this.task.dimensions.filter(dimension => dimension.scale && dimension.scale.type === "categorical").length > 1) {
let currentValue = String(Object.keys(eventData).includes('value') ? eventData.value : eventData.target.value)
let primaryCategoricalDimension = this.getPrimaryCategoricalDimension();
let previousValue = this.assessmentForm.controls[primaryCategoricalDimension.name.concat('_value').concat('')].value;
Expand Down Expand Up @@ -277,7 +277,7 @@ export class DimensionComponent implements OnInit, OnChanges {
}

public isVideoTypeLabelCategorical(currentCategoricalDimension : Dimension): boolean {
if (currentCategoricalDimension.scale instanceof ScaleCategorical) {
if (currentCategoricalDimension.scale && currentCategoricalDimension.scale instanceof ScaleCategorical) {
let primaryCategoricalDimension = this.getPrimaryCategoricalDimension();
return this.task.settings.attributesMain.some(attribute => attribute.is_video) && currentCategoricalDimension.name != primaryCategoricalDimension.name;
}
Expand All @@ -293,16 +293,16 @@ export class DimensionComponent implements OnInit, OnChanges {

private getPrimaryCategoricalDimension(): Dimension {
/* Get the first categorical dimension - the master categorical dimension */
return this.task.dimensions.filter(dimension => dimension.scale.type == "categorical")[0];
return this.task.dimensions.find(dimension => dimension.scale && dimension.scale.type === "categorical");
}

private getSecondaryCategoricalDimension(): Dimension {
/* Get the second categorical dimension */
return this.task.dimensions.filter(dimension => dimension.scale.type == "categorical")[1];
return this.task.dimensions.filter(dimension => dimension.scale && dimension.scale.type === "categorical")[1];
}

private getIntervalDimension(): Dimension {
return this.task.dimensions.find(dimension => dimension.scale.type == "interval")
return this.task.dimensions.find(dimension => dimension.scale && dimension.scale.type === "interval")
}

public sliderDisabled(): boolean {
Expand Down

0 comments on commit 187d268

Please sign in to comment.