Skip to content

Commit

Permalink
feat(graph): Set interval as year instead of month for ORCID evolution
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Jan 19, 2024
1 parent c4046be commit b68c72a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/components/Charts/orcid/general/present/get-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ function useGetData(beforeLastObservationSnap, observationSnap, domain) {
const queryAll = getFetchOptions({
key: 'orcidNumber',
domain,
parameters: ['month', ['address', 'employment', 'education']],
parameters: ['year', ['address', 'employment', 'education']],
objectType: ['orcid'],
});
queries.push(Axios.post(ES_ORCID_API_URL, queryAll, HEADERS));
const queryEmployment = getFetchOptions({
key: 'orcidNumber',
domain,
parameters: ['month', ['employment']],
parameters: ['year', ['employment']],
objectType: ['orcid'],
});
queries.push(Axios.post(ES_ORCID_API_URL, queryEmployment, HEADERS));
const res = await Axios.all(queries);
const data = res[0].data.aggregations.orcid_per_day.buckets;
const dataEmployment = res[1].data.aggregations.orcid_per_day.buckets;
const data = res[0].data.aggregations.orcid_per_year.buckets;
const dataEmployment = res[1].data.aggregations.orcid_per_year.buckets;
const bsoDomain = intl.formatMessage({ id: `app.bsoDomain.${domain}` });
const categories = [];
const total = [];
Expand All @@ -47,7 +47,7 @@ function useGetData(beforeLastObservationSnap, observationSnap, domain) {
};
data.forEach((el) => {
const currentDate = Highcharts.dateFormat(
'%Y-%m',
'%Y',
new Date(el.key_as_string).getTime(),
);
categories.push(currentDate);
Expand All @@ -61,7 +61,7 @@ function useGetData(beforeLastObservationSnap, observationSnap, domain) {
});
dataEmployment.forEach((el) => {
const currentDate = Highcharts.dateFormat(
'%Y-%m',
'%Y',
new Date(el.key_as_string).getTime(),
);
employment.push({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/chartFetchOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ export default function getFetchOptions({
},
},
aggs: {
orcid_per_day: {
orcid_per_year: {
date_histogram: {
field: 'creation_date',
calendar_interval: interval,
Expand Down

0 comments on commit b68c72a

Please sign in to comment.