Skip to content

Commit

Permalink
Merge pull request #7131 from ORNL-AMO/issues-7045-6923
Browse files Browse the repository at this point in the history
Issues 7045 6923
  • Loading branch information
nbintertech authored Nov 13, 2024
2 parents 136225f + 714c9e1 commit 1c18b78
Showing 1 changed file with 35 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ export class TreasureHuntPptService {
slideTeamSummary.addText('Placeholder for picture', { x: 8.32, y: 1.8, w: 4.43, h: 2.81, align: 'center', fill: { color: 'BDEEFF' }, color: 'BFBFBF', fontSize: 18, fontFace: 'Arial (Body)', valign: 'middle', isTextBox: true, autoFit: true });
slideTeamSummary.addText('Team Members:', slideTextProps);

// todo next time we're in here opportunityCardsData should be filtered by opportunitySummaries that exist in it, otherwise we iterate over all
opportunityCardsData.forEach((opp, index) => {
let opportunitySummary: OpportunitySummary = treasureHuntResults.opportunitySummaries[index];
if (opportunitySummary && opp.opportunitySheet.owner == team.team) {

opportunityCardsData = _.orderBy(opportunityCardsData, 'name', 'asc');

opportunityCardsData.forEach((opp: OpportunityCardData) => {
if (opp.opportunitySheet.owner == team.team) {
let newSlide = pptx.addSlide({ masterName: "MASTER_SLIDE" });
newSlide.addText('Opportunity: ' + opp.name, slideTitleProperties);
let slideText: { text: pptxgen.TextProps[], options: pptxgen.TextPropsOptions } = this.getOpportunitySlideText(opp.opportunitySheet);
Expand All @@ -295,32 +296,20 @@ export class TreasureHuntPptService {
{ text: "Total Cost", options: { color: "FFFFFF", bold: true, fill: { color: '1D428A' } } },
{ text: "Payback (Years)", options: { color: "FFFFFF", bold: true, fill: { color: '1D428A' } } }
]);
let utilityUnit: string;
if (opportunitySummary.mixedIndividualResults) {
opportunitySummary.mixedIndividualResults.forEach(individualResults => {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(individualResults.utilityType, settings);
rows.push([
individualResults.utilityType,
this.treasureHuntPptTableService.roundValToFormatString(individualResults.totalEnergySavings),
utilityUnit,
this.treasureHuntPptTableService.roundValToCurrency(individualResults.costSavings),
this.treasureHuntPptTableService.roundValToCurrency(individualResults.opportunityCost.material),
this.treasureHuntPptTableService.roundValToCurrency(individualResults.opportunityCost.labor),
this.treasureHuntPptTableService.getOtherCost(individualResults.opportunityCost),
this.treasureHuntPptTableService.roundValToCurrency(individualResults.totalCost),
this.treasureHuntPptTableService.roundValToFormatString(individualResults.payback)]);
});
} else {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(opportunitySummary.utilityType, settings);
rows.push([opportunitySummary.utilityType,
this.treasureHuntPptTableService.roundValToFormatString(opportunitySummary.totalEnergySavings),
utilityUnit, this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.costSavings),
this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.opportunityCost.material),
this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.opportunityCost.labor),
this.treasureHuntPptTableService.getOtherCost(opportunitySummary.opportunityCost),
this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.totalCost),
this.treasureHuntPptTableService.roundValToFormatString(opportunitySummary.payback)]);
}
let utilityUnit: string;
opp.annualEnergySavings.forEach(annulEnergy => {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(annulEnergy.label, settings);
rows.push([
annulEnergy.label,
this.treasureHuntPptTableService.roundValToFormatString(annulEnergy.savings),
utilityUnit,
this.treasureHuntPptTableService.roundValToCurrency(opp.annualCostSavings),
this.treasureHuntPptTableService.roundValToCurrency(opp.opportunitySheet.opportunityCost.material),
this.treasureHuntPptTableService.roundValToCurrency(opp.opportunitySheet.opportunityCost.labor),
this.treasureHuntPptTableService.getOtherCost(opp.opportunitySheet.opportunityCost),
this.treasureHuntPptTableService.roundValToCurrency(opp.implementationCost),
this.treasureHuntPptTableService.roundValToFormatString(opp.paybackPeriod)]);
});
newSlide.addTable(rows, { x: 1.14, y: 5.2, w: 11.05, colW: [1.5, 1.5, 0.8, 1.25, 1.25, 1.25, 1.25, 1.25, 1], color: "1D428A", fontSize: 12, fontFace: 'Arial (Body)', border: { type: "solid", color: '1D428A' }, fill: { color: 'BDEEFF' }, align: 'left', valign: 'middle' });
}
});
Expand Down Expand Up @@ -349,11 +338,9 @@ export class TreasureHuntPptService {
let oppsWithNoTeam = pptx.addSlide();
oppsWithNoTeam.background = { data: betterPlantsPPTimg.betterPlantsSectionSlide };
oppsWithNoTeam.addText('Other Opportunities', { w: '100%', h: '100%', align: 'center', bold: true, color: 'FFFFFF', fontSize: 68, fontFace: 'Arial (Headings)', valign: 'middle', isTextBox: true, autoFit: true });

// todo opportunityCardsData should be filtered by opportunitySummaries that exist in it, otherwise we iterate over all
opportunityCardsData.forEach((opp, index) => {
let opportunitySummary: OpportunitySummary = treasureHuntResults.opportunitySummaries[index];
if (opportunitySummary && !opp.opportunitySheet.owner) {

opportunityCardsData.forEach((opp) => {
if (!opp.opportunitySheet.owner) {
let newSlide = pptx.addSlide({ masterName: "MASTER_SLIDE" });
newSlide.addText('Opportunity: ' + opp.name, slideTitleProperties);
let slideText: { text: pptxgen.TextProps[], options: pptxgen.TextPropsOptions } = this.getOpportunitySlideText(opp.opportunitySheet);
Expand All @@ -372,16 +359,19 @@ export class TreasureHuntPptService {
{ text: "Payback (Years)", options: { color: "FFFFFF", bold: true, fill: { color: '1D428A' } } }
]);
let utilityUnit: string;
if (opportunitySummary.mixedIndividualResults) {
opportunitySummary.mixedIndividualResults.forEach(individualResults => {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(individualResults.utilityType, settings);
rows.push([individualResults.utilityType, this.treasureHuntPptTableService.roundValToFormatString(individualResults.totalEnergySavings), utilityUnit, this.treasureHuntPptTableService.roundValToCurrency(individualResults.costSavings), this.treasureHuntPptTableService.roundValToCurrency(individualResults.opportunityCost.material), this.treasureHuntPptTableService.roundValToCurrency(individualResults.opportunityCost.labor), this.treasureHuntPptTableService.getOtherCost(individualResults.opportunityCost), this.treasureHuntPptTableService.roundValToCurrency(individualResults.totalCost), this.treasureHuntPptTableService.roundValToFormatString(opportunitySummary.payback)]);
});
} else {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(opportunitySummary.utilityType, settings);
rows.push([opportunitySummary.utilityType, this.treasureHuntPptTableService.roundValToFormatString(opportunitySummary.totalEnergySavings), utilityUnit, this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.costSavings), this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.opportunityCost.material), this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.opportunityCost.labor), this.treasureHuntPptTableService.getOtherCost(opportunitySummary.opportunityCost), this.treasureHuntPptTableService.roundValToCurrency(opportunitySummary.totalCost), this.treasureHuntPptTableService.roundValToFormatString(opportunitySummary.payback)]);
}

opp.annualEnergySavings.forEach(annulEnergy => {
utilityUnit = this.treasureHuntPptTableService.getUtilityUnit(annulEnergy.label, settings);
rows.push([
annulEnergy.label,
this.treasureHuntPptTableService.roundValToFormatString(annulEnergy.savings),
utilityUnit,
this.treasureHuntPptTableService.roundValToCurrency(opp.annualCostSavings),
this.treasureHuntPptTableService.roundValToCurrency(opp.opportunitySheet.opportunityCost.material),
this.treasureHuntPptTableService.roundValToCurrency(opp.opportunitySheet.opportunityCost.labor),
this.treasureHuntPptTableService.getOtherCost(opp.opportunitySheet.opportunityCost),
this.treasureHuntPptTableService.roundValToCurrency(opp.implementationCost),
this.treasureHuntPptTableService.roundValToFormatString(opp.paybackPeriod)]);
});
newSlide.addTable(rows, { x: 1.14, y: 5.2, w: 11.05, colW: [1.5, 1.5, 0.8, 1.25, 1.25, 1.25, 1.25, 1.25, 1], color: "1D428A", fontSize: 12, fontFace: 'Arial (Body)', border: { type: "solid", color: '1D428A' }, fill: { color: 'BDEEFF' }, align: 'left', valign: 'middle' });
}
});
Expand Down

0 comments on commit 1c18b78

Please sign in to comment.