Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clean ou dimension before app switching (DHIS2-8585) #582

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/util/analyticalObject.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { config, getInstance as getD2 } from 'd2';
import { getPeriodNameFromId, getDimensionsFromFilters } from './analytics';
import { loadDataItemLegendSet } from './legend';
import { cleanDimension } from './favorites';

export const NAMESPACE = 'analytics';
export const CURRENT_AO_KEY = 'currentAnalyticalObject';
Expand Down Expand Up @@ -91,7 +92,7 @@ export const getAnalyticalObjectFromThematicLayer = (layer = {}) => {

return {
columns,
rows,
rows: rows.map(cleanDimension),
filters,
aggregationType,
};
Expand Down
2 changes: 1 addition & 1 deletion src/util/favorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const models2objects = config => {
return config;
};

const cleanDimension = dim => ({
export const cleanDimension = dim => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really located in the right place, now that it's being used by both favourites and analyticalObject.js?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could be moved to the util/analytics.js, but it requires a bigger rewrite I would like to save for later (and possibly reuse code you've made for DV).

...dim,
items: dim.items.map(item => pick(validModelProperties, item)),
});
Expand Down