Skip to content

Commit

Permalink
Merge pull request #8 from spidasoftware/add-include-strength-support…
Browse files Browse the repository at this point in the history
…-162248054

[Delivers #162248054] add load case useStrengthResults support
  • Loading branch information
spidaKevinGentile authored Dec 13, 2018
2 parents cd63e52 + 2667c03 commit a4b6ed2
Show file tree
Hide file tree
Showing 4 changed files with 7,291 additions and 5 deletions.
22 changes: 20 additions & 2 deletions cmds/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function resolvePayload(partialPayloadP, structure) {
return {
analysisCase,
structure,
clientData: clientData.clientItemsForStructure(structure)
clientData: maybeAddStrengthCase(analysisCase, clientData, clientData.clientItemsForStructure(structure))
};
});
}
Expand Down Expand Up @@ -251,7 +251,6 @@ function createPartialPayload(argv) {
return clientDataP.then(clientData => {
let name;
let type;

if (argv.loadCaseName) {
type = 'load';
name = argv.loadCaseName;
Expand All @@ -277,6 +276,25 @@ function createPartialPayload(argv) {
return false;
}

// We assume only a single strength case in client data
function maybeAddStrengthCase(analysisCase, clientData, structureComponents){
if(analysisCase.useStrengthResults === true){
if(Object.keys(clientData.analysisCases.strength).length < 1){
throw("\nLoad case has useStrengthResults: TRUE, but no strength case exists in client data");
} else if (Object.keys(clientData.analysisCases.strength).length > 1) {
throw("\nClient data contains more than one strength case. Only one strength case was expected");
}
let useCaseKey;
for(let key in clientData.analysisCases.strength){
if(key !== undefined) {
useCaseKey = key;
}
}
structureComponents.analysisCases = [clientData.analysisCases.strength[useCaseKey]];
}
return structureComponents;
}

function batchJobs(argv) {
const batch = _.partialRight(_.chunk,BATCH_SIZE);

Expand Down
12 changes: 9 additions & 3 deletions lib/clientData.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,25 @@ function extractAnalysisCases(clientData) {
const strength = {};

const { analysisCases } = clientData;

let includeStrengthAnalsyis = false;
if (analysisCases) {
for (let analysisCase of analysisCases) {
if (isStrengthCase(analysisCase)) {
strength[analysisCase.name]=analysisCase;
} else {
load[analysisCase.name]=analysisCase;
if(analysisCase.useStrengthResults){
includeStrengthAnalsyis = true;
}
}
}

delete clientData.analysisCases;
if(includeStrengthAnalsyis){
clientData.analysisCases = strength;
} else {
delete clientData.analysisCases;
}
}

return { load, strength };
}

Expand Down
Loading

0 comments on commit a4b6ed2

Please sign in to comment.