Skip to content

Commit

Permalink
fix(debug): Disable debugging mode
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Jul 26, 2023
1 parent 67800f1 commit 13d1488
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
6 changes: 3 additions & 3 deletions client/.env
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
VITE_APP_NAME="Publications finder"
VITE_BSO_AUTH="Basic QlNPOnZuODRxOVhlZjlVN3BtVQ=="
VITE_BSO_MAX_SIZE=10000
VITE_BSO_SIZE=5000
VITE_BSO_SIZE=100
VITE_BSO_URL="https://cluster.elasticsearch.dataesr.ovh/bso3-datacite,bso-publications"
VITE_DESCRIPTION="Application to find scientific publications"
VITE_GIT_REPOSITORY_URL="https://github.com/dataesr/publications-finder/"
VITE_HEADER_TAG="dev"
VITE_HEADER_TAG_COLOR="green-emeraude"
VITE_MINISTER_NAME="Minisère de l'enseignement supérieur et de la recherche"
VITE_OPENALEX_PER_PAGE=200
VITE_OPENALEX_SIZE=1000
VITE_OPENALEX_PER_PAGE=20
VITE_OPENALEX_SIZE=100
VITE_VERSION=$npm_package_version
25 changes: 0 additions & 25 deletions client/src/pages/home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,18 @@ const {
VITE_BSO_MAX_SIZE,
} = import.meta.env;

const onRender = (id, phase, actualTime, baseTime, startTime, endTime) => {
console.log(`>>>>> ${id} / ${phase} => ${actualTime} ms`);
// console.log(`Actual time: ${actualTime}`);
// console.log(`Base time: ${baseTime}`);
// console.log(`Start time: ${startTime}`);
// console.log(`End time: ${endTime}`);
};

const getRorAffiliations = (affiliations) => {
console.time('getRorAffiliations');
const notRorAffiliations = [];
const rorAffiliations = [];
const regexp = /^(https:\/\/ror\.org\/|ror\.org\/){0,1}0[a-hj-km-np-tv-z|0-9]{6}[0-9]{2}$/;
affiliations.forEach((affiliation) => {
// eslint-disable-next-line no-unused-expressions
affiliation.match(regexp) ? rorAffiliations.push(affiliation) : notRorAffiliations.push(affiliation);
});
console.timeEnd('getRorAffiliations');
return { notRorAffiliations, rorAffiliations };
};

const getData = async (options) => {
console.time('getData');

const promises = options?.datasources.map((datasource) => {
switch (datasource) {
case 'bso':
Expand Down Expand Up @@ -99,7 +87,6 @@ const getData = async (options) => {
const { count } = await getBsoCount(options);
data.total.bso = count;
}

// Deduplicate publications by DOI or by hal_id
data.total.all = data.results.length;
const deduplicatedPublications = {};
Expand All @@ -113,8 +100,6 @@ const getData = async (options) => {
});
data.results = Object.values(deduplicatedPublications);
data.total.deduplicated = Object.values(deduplicatedPublications).length;
console.timeEnd('getData');

return data;
};

Expand Down Expand Up @@ -145,7 +130,6 @@ export default function Home() {
};

useEffect(() => {
console.time('publicationsDataTableTmp');
let publicationsDataTableTmp = [];
if (data) {
publicationsDataTableTmp = data.results
Expand All @@ -159,9 +143,7 @@ export default function Home() {
}));
}
setPublicationsDataTable(publicationsDataTableTmp);
console.timeEnd('publicationsDataTableTmp');
// Group by affiliation
console.time('dataGroupedByAffiliation');
const normalizedName = (name) => name.toLowerCase().replace(/[^a-zA-Z0-9]/g, '').replace('<em>', '').replace('</em>', '');
let affiliationsDataTableTmp = {};
if (data) {
Expand Down Expand Up @@ -203,21 +185,17 @@ export default function Home() {
.sort((a, b) => b.publications.length - a.publications.length)
.map((affiliation, index) => ({ ...affiliation, id: index.toString() }));
setAffiliationsDataTable(affiliationsDataTableTmp);
console.timeEnd('dataGroupedByAffiliation');
}, [data]);

const tagPublications = (publications, action, setSelectedPublications) => {
console.time('tagPublications');
const publicationsDataTableTmp = [...publicationsDataTable];
const publicationIds = publications.map((publication) => publication.id);
publicationsDataTableTmp.filter((publication) => publicationIds.includes(publication.id)).map((publication) => publication.status = action);
setPublicationsDataTable(publicationsDataTableTmp);
setSelectedPublications([]);
console.timeEnd('tagPublications');
};

const tagAffiliations = (affiliations, action) => {
console.time('tagAffiliations');
const publicationsDataTableTmp = [...publicationsDataTable];
const affiliationIds = affiliations.map((affiliation) => affiliation.id);
const publicationIds = affiliations.map((affiliation) => affiliation.publications.map((publication) => publication.id)).flat();
Expand All @@ -227,17 +205,14 @@ export default function Home() {
affiliationsDataTableTmp.filter((affiliation) => affiliationIds.includes(affiliation.id)).map((affiliation) => affiliation.display = false);
setAffiliationsDataTable(affiliationsDataTableTmp);
setSelectedAffiliations([]);
console.timeEnd('tagAffiliations');
};

const checkSelectedAffiliation = () => {
console.time('checkSelectedAffiliation');
let ret = false;
if (!selectedAffiliations) ret = true;
if (Object.keys(selectedAffiliations)?.length === 0 && selectedAffiliations?.constructor === Object) {
ret = true;
}
console.timeEnd('checkSelectedAffiliation');
return ret;
};

Expand Down

0 comments on commit 13d1488

Please sign in to comment.