Skip to content

Commit 6308fc2

Browse files
refactor: address code smells (#304)
1 parent 5670227 commit 6308fc2

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

service/analysisService.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ class AnalysisService extends HttpFactory {
3636

3737
async getAllAnalyses() {
3838
const analyses = await this.getCall<Analysis[]>(this.RESOURCE);
39-
const analysesWithCO2Converted = analyses.map((analysis) => ({
39+
return analyses.map((analysis) => ({
4040
...analysis,
4141
co2Converted: convertEstimateToBestMassUnit(analysis.co2Gr),
4242
}));
43-
44-
return analysesWithCO2Converted;
4543
}
4644

4745
async getAnalysisById(analysisId: string) {

service/awsDataCenterService.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ class AWSDataCenterService extends HttpFactory {
4343
const infrastructure =
4444
await this.infrastructureService.getInfrastructure(infrastructureId);
4545
const regions = await this.getAllAWSDataCenter();
46-
const currentRegion = regions.find(
47-
(region) => region.id === infrastructure.defaultRegion,
48-
);
49-
return currentRegion;
46+
return regions.find((region) => region.id === infrastructure.defaultRegion);
5047
}
5148
}
5249

service/scanService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ class ScanService extends HttpFactory {
2222
private readonly RESOURCE = "/api/scanner";
2323
async getAllScans(): Promise<Scan[]> {
2424
const scans = await this.getCall<Scan[]>(this.RESOURCE);
25-
const scansWithCO2Converted = scans.map((scan) => ({
25+
return scans.map((scan) => ({
2626
...scan,
2727
co2Converted: convertEstimateToBestMassUnit(scan.co2Gr),
2828
}));
29-
return scansWithCO2Converted;
3029
}
3130

3231
async getScanById(scanId: string): Promise<EstimatedScan> {

0 commit comments

Comments
 (0)