@adobe/spacecat-shared-data-access 1.2.5 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/service/sites/accessPatterns.js +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.2.6](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.2.5...@adobe/spacecat-shared-data-access-v1.2.6) (2023-12-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* include sites without latest audits ([#45](https://github.com/adobe-rnd/spacecat-shared/issues/45)) ([b843190](https://github.com/adobe-rnd/spacecat-shared/commit/b843190da09916832a743d6fc4bf83e804b61912))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v1.2.5](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.2.4...@adobe/spacecat-shared-data-access-v1.2.5) (2023-12-10)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -55,7 +55,10 @@ export const getSitesToAudit = async (dynamoClient, config) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Retrieves sites with their latest audit of a specified type.
|
|
58
|
+
* Retrieves sites with their latest audit of a specified type. If there is
|
|
59
|
+
* no audit of the specified type for a site, the site will be returned with
|
|
60
|
+
* an empty audits array.
|
|
61
|
+
* The audits are sorted ascending or descending by scores.
|
|
59
62
|
*
|
|
60
63
|
* @param {DynamoDbClient} dynamoClient - The DynamoDB client.
|
|
61
64
|
* @param {DataAccessConfig} config - The data access config.
|
|
@@ -78,16 +81,17 @@ export const getSitesWithLatestAudit = async (
|
|
|
78
81
|
getLatestAudits(dynamoClient, config, log, auditType, sortAuditsAscending),
|
|
79
82
|
]);
|
|
80
83
|
|
|
81
|
-
const
|
|
84
|
+
const auditsMap = new Map(latestAudits.map((audit) => [audit.getSiteId(), audit]));
|
|
82
85
|
|
|
83
|
-
return
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
+
return sites.map((site) => {
|
|
87
|
+
const audit = auditsMap.get(site.getId());
|
|
88
|
+
if (audit) {
|
|
86
89
|
site.setAudits([audit]);
|
|
87
|
-
|
|
90
|
+
} else {
|
|
91
|
+
site.setAudits([]);
|
|
88
92
|
}
|
|
89
|
-
return
|
|
90
|
-
}
|
|
93
|
+
return site;
|
|
94
|
+
});
|
|
91
95
|
};
|
|
92
96
|
|
|
93
97
|
/**
|