Skip to content

Commit

Permalink
changes in pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Ahlskog committed Oct 4, 2023
1 parent e4ceefd commit a6f4907
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/lib/BodyBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export class BodyBuilder {
const sastNumberOfSeverity2: string = process.env.SASTnumberOfSeverity2 || '';
const sastNumberOfSeverity3: string = process.env.SASTnumberOfSeverity3 || '';

const tmNumberOfActiveTickets: string = process.env.tmNumberOfActiveTickets || '';
const tmNumberOfClosedTickets: string = process.env.tmNumberOfClosedTickets || '';
const tmNumberOfActiveTickets: string | undefined = process.env.tmNumberOfActiveTickets || undefined;
const tmNumberOfClosedTickets: string | undefined = process.env.tmNumberOfClosedTickets || undefined;

const ptNumberOfActiveTickets: string = process.env.ptNumberOfActiveTickets || '';
const ptNumberOfClosedTickets: string = process.env.ptNumberOfClosedTickets || '';
const ptNumberOfActiveTickets: string | undefined = process.env.ptNumberOfActiveTickets || undefined;
const ptNumberOfClosedTickets: string | undefined = process.env.ptNumberOfClosedTickets || undefined;

const numUserInProdSeverity1: string = process.env.numUserInProdSeverity1 || '';
const numUserInProdSeverity2: string = process.env.numUserInProdSeverity2 || '';
Expand Down
20 changes: 12 additions & 8 deletions src/lib/ResponseBodyBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ export class ResponseBodyBuilder {

setThreatModelingDate(
threatModelingDate: string,
tmNumberOfActiveTickets: string,
tmNumberOfClosedTickets: string
tmNumberOfActiveTickets: string | undefined,
tmNumberOfClosedTickets: string | undefined
): this {
if (!threatModelingDate) {
return this;
} else {
if ((!tmNumberOfActiveTickets && !tmNumberOfClosedTickets) || ((tmNumberOfActiveTickets && tmNumberOfClosedTickets) !== '')) {
if (tmNumberOfActiveTickets !== undefined) {
this.responseBody.tmNumberOfActiveTickets = tmNumberOfActiveTickets;
}
if (tmNumberOfClosedTickets !== undefined) {
this.responseBody.tmNumberOfClosedTickets = tmNumberOfClosedTickets;
}
this.responseBody.threatModelingDate = threatModelingDate;
Expand Down Expand Up @@ -131,15 +133,17 @@ export class ResponseBodyBuilder {
}
}

setPentestDate(pentestDate: string, ptNumberOfActiveTickets: string, ptNumberOfClosedTickets: string): this {
setPentestDate(pentestDate: string, ptNumberOfActiveTickets: string | undefined, ptNumberOfClosedTickets: string | undefined): this {
if (!pentestDate) {
return this;
} else {
if ((!ptNumberOfActiveTickets && !ptNumberOfClosedTickets) || ((ptNumberOfActiveTickets && ptNumberOfClosedTickets) !== '')) {
this.responseBody.ptNumberOfActiveTickets = ptNumberOfActiveTickets;
this.responseBody.ptNumberOfClosedTickets = ptNumberOfClosedTickets;
if (ptNumberOfActiveTickets !== undefined) {
this.responseBody.tmNumberOfActiveTickets = ptNumberOfActiveTickets;
}
if (ptNumberOfClosedTickets !== undefined) {
this.responseBody.tmNumberOfClosedTickets = ptNumberOfClosedTickets;
}
this.responseBody.pentestDate = pentestDate;
this.responseBody.threatModelingDate = pentestDate;
return this;
}
}
Expand Down

0 comments on commit a6f4907

Please sign in to comment.