|
|
@@ -93,8 +93,12 @@ export class AdjusterService {
|
|
|
|
|
|
/* Listen to schema changes so the factors can be re-arranged in the view */
|
|
|
this.adjusterPresetsService.schemaChanges.subscribe((newSchema) => {
|
|
|
- //TODO: i18n this!
|
|
|
+ const orphanedDatasets = [];
|
|
|
this.factors = newSchema.groups.map((group) => {
|
|
|
+ const datasets = this.adjusterPresetsService.getGroupDatasets(group.id);
|
|
|
+ if (datasets.length < 3) {
|
|
|
+ orphanedDatasets.push(...datasets);
|
|
|
+ }
|
|
|
return {
|
|
|
id: group.id,
|
|
|
labels: group.labels,
|
|
|
@@ -102,6 +106,13 @@ export class AdjusterService {
|
|
|
datasets: this.adjusterPresetsService.getGroupDatasets(group.id)
|
|
|
}
|
|
|
});
|
|
|
+ this.factors = this.factors.filter((factor) => factor.datasets.length >= 3);
|
|
|
+ this.factors.push({
|
|
|
+ id: 'others',
|
|
|
+ labels: [{'@value': 'Ostatní', '@language': 'cs'}, {'@value': 'Others', '@language': 'en'}],
|
|
|
+ weight: this.resetFactorWeights('others'),
|
|
|
+ datasets: orphanedDatasets
|
|
|
+ })
|
|
|
});
|
|
|
|
|
|
/* Listen to problem changes so the datasets can be turned on/off */
|