diff --git a/server/src/routes/works.routes.js b/server/src/routes/works.routes.js
index d01bf7a..aedcd57 100644
--- a/server/src/routes/works.routes.js
+++ b/server/src/routes/works.routes.js
@@ -48,12 +48,12 @@ const getData = async ({ options, resetCache = false }) => {
shasum.update(JSON.stringify(options));
const searchId = shasum.digest('hex');
const queryId = Math.floor(Math.random() * SEED_MAX);
- console.time(`0. Query ${queryId} | Retrieve cache if exists ${options.affiliationStrings}`);
let cache = false;
if (USE_CACHE) {
+ console.time(`0. Query ${queryId} | Retrieve cache if exists ${options.affiliationStrings}`);
cache = await getCache({ searchId });
+ console.timeEnd(`0. Query ${queryId} | Retrieve cache if exists ${options.affiliationStrings}`);
}
- console.timeEnd(`0. Query ${queryId} | Retrieve cache if exists ${options.affiliationStrings}`);
if (cache && !resetCache) {
const extractionDate = new Date(cache.extractionDate);
console.log(`0. Query ${queryId}`, `returning cached data from ${extractionDate}`);
diff --git a/server/src/utils/works.js b/server/src/utils/works.js
index 0443f71..1004a7b 100644
--- a/server/src/utils/works.js
+++ b/server/src/utils/works.js
@@ -440,7 +440,7 @@ const groupByAffiliations = ({ options, works }) => {
const matches = regexp.exec(displayAffiliation);
// Set each matched word in bold
matches?.slice(1)?.forEach((match) => {
- displayAffiliation = displayAffiliation.replace(match, '$&');
+ displayAffiliation = displayAffiliation.replaceAll(match, '$&');
});
let keepAffiliation = displayAffiliation.includes('');
const rorsInAffiliation = affiliation.rors?.map((a) => a.rorId) || [];