Skip to content

Commit

Permalink
fix: added completedOnly to all vis types (#736)
Browse files Browse the repository at this point in the history
Adds the completedOnly option to the option modal, api requests and data download
  • Loading branch information
martinkrulltott committed Feb 27, 2020
1 parent 8d4b280 commit 7eb324d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/app/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-09-16T07:28:39.022Z\n"
"PO-Revision-Date: 2019-09-16T07:28:39.022Z\n"
"POT-Creation-Date: 2020-02-26T13:21:17.550Z\n"
"PO-Revision-Date: 2020-02-26T13:21:17.550Z\n"

msgid "Rename successful"
msgstr ""
Expand Down Expand Up @@ -186,6 +186,9 @@ msgstr ""
msgid "Base line value"
msgstr ""

msgid "Only include completed events"
msgstr ""

msgid "Use cumulative values"
msgstr ""

Expand Down
1 change: 1 addition & 0 deletions packages/app/src/api/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const apiDownloadData = async (current, format, idScheme, path) => {

let req = new d2.analytics.request()
.fromModel(current, path === 'dataValueSet')
.withParameters({ completedOnly: current.completedOnly })
.withFormat(format);

if (path) {
Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/components/VisualizationOptions/DataTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import TargetLine from './Options/TargetLine';
import BaseLine from './Options/BaseLine';
import SortOrder from './Options/SortOrder';
import AggregationType from './Options/AggregationType';
import CompletedOnly from './Options/CompletedOnly';
import styles from './styles/VisualizationOptions.style';

export const DataTab = ({ classes }) => (
<FormGroup className={classes.dataTabFormGroup}>
<ShowData />
<PercentStackedValues />
<CumulativeValues />
<CompletedOnly />
<HideEmptyRowItems />
<RegressionType />
<TargetLine />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import i18n from '@dhis2/d2-i18n';
import { withStyles } from '@material-ui/core/styles';
import CheckboxBaseOption from './CheckboxBaseOption';
import styles from '../styles/VisualizationOptions.style';

const CompletedOnly = ({ classes }) => (
<CheckboxBaseOption
className={classes.dataTabCheckbox}
option={{
name: 'completedOnly',
label: i18n.t('Only include completed events'),
}}
/>
);

CompletedOnly.propTypes = {
classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(CompletedOnly);
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('The DataTab component', () => {
const wrappingDiv = dataTab()
.find(FormGroup)
.first();
expect(wrappingDiv.children()).toHaveLength(9);
expect(wrappingDiv.children()).toHaveLength(10);
});

[
Expand Down

0 comments on commit 7eb324d

Please sign in to comment.