Skip to content

Commit

Permalink
862 Replace value "null" in saved models
Browse files Browse the repository at this point in the history
  • Loading branch information
1fifoto committed Oct 15, 2023
1 parent 3328f6b commit 8c7d8bb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 45 deletions.
30 changes: 15 additions & 15 deletions client/src/designtypes/Spring/Compression/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,21 +322,7 @@ export function migrate(design) {
// Remove ioclass from all Symbol Table entries
design.symbol_table.forEach((element) => { // For each Symbol Table entry
delete element.ioclass;
// Added to migration on 10/15/2023 after finding #862 Issue
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
// Added to migration on 10/15/2023 after finding #862 Issue
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// #609 Add standard size table for metric Outside Diameters
// Update Material_Type = 31 table and Material_File = 34 value
// console.log('Material_File.value=',design.symbol_table[34].value,'Material_Type.table=',design.symbol_table[31].table)
Expand Down Expand Up @@ -387,7 +373,21 @@ export function migrate(design) {
case '12':
// Current model version
// console.log('Convert from 12 to 13');
// To be defined - presently do nothing
// Added to migration on 10/15/2023 after finding #862 Issue
design.symbol_table.forEach((element) => { // For each Symbol Table entry
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// migrated_design.version = '13'; // last thing... set the migrated model version

break; // Do not copy this break
Expand Down
30 changes: 15 additions & 15 deletions client/src/designtypes/Spring/Extension/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,7 @@ export function migrate(design) {
// Remove ioclass from all Symbol Table entries
design.symbol_table.forEach((element) => { // For each Symbol Table entry
delete element.ioclass;
// Added to migration on 10/15/2023 after finding #862 Issue
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
// Added to migration on 10/15/2023 after finding #862 Issue
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// #609 Add standard size table for metric Outside Diameters
// Update Material_Type = 37 table and Material_File = 40 value
// console.log('Material_File.value=',design.symbol_table[40].value,'Material_Type.table=',design.symbol_table[37].table)
Expand Down Expand Up @@ -334,7 +320,21 @@ export function migrate(design) {
case '8':
// Current model version
// console.log('Convert from 8 to 9');
// To be defined - presently do nothing
// Added to migration on 10/15/2023 after finding #862 Issue
design.symbol_table.forEach((element) => { // For each Symbol Table entry
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// migrated_design.version = '9'; // last thing... set the migrated model version

break; // Do not copy this break
Expand Down
30 changes: 15 additions & 15 deletions client/src/designtypes/Spring/Torsion/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,7 @@ export function migrate(design) {
// Remove ioclass from all Symbol Table entries
design.symbol_table.forEach((element) => { // For each Symbol Table entry
delete element.ioclass;
// Added to migration on 10/15/2023 after finding #862 Issue
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
// Added to migration on 10/15/2023 after finding #862 Issue
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// #609 Add standard size table for metric Outside Diameters
// Update Material_Type = 31 table and Material_File = 36 value
// console.log('Material_File.value=',design.symbol_table[36].value,'Material_Type.table=',design.symbol_table[31].table)
Expand Down Expand Up @@ -312,7 +298,21 @@ export function migrate(design) {
case '8':
// Current model version
// console.log('Convert from 8 to 9');
// To be defined - presently do nothing
// Added to migration on 10/15/2023 after finding #862 Issue
design.symbol_table.forEach((element) => { // For each Symbol Table entry
if (element.value === null) {
element.value = 1;
}
if (element.cmin === null) {
element.cmin = element.value;
}
if (element.cmax === null) {
element.cmax = element.value;
}
});
if (design.result.objective_value === null) {
design.result.objective_value = 0.0;
}
// migrated_design.version = '9'; // last thing... set the migrated model version

break; // Do not copy this break
Expand Down

0 comments on commit 8c7d8bb

Please sign in to comment.