Skip to content

Commit

Permalink
fix(stats): ajout ecouteur clique edition journée + nombre de comment…
Browse files Browse the repository at this point in the history
…aire par questionnaire
  • Loading branch information
tangimds committed Jan 12, 2022
1 parent d600cbc commit cc1a36d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/scenes/status/status-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Posology from './posology';
import {canEdit} from './utils/index.js';
import Button from '../../components/RoundButtonIcon';
import Toxic from './toxic';
import logEvents from '../../services/logEvents';

export default ({navigation, patientState, date}) => {
const [customs, setCustoms] = useState([]);
Expand Down Expand Up @@ -47,6 +48,7 @@ export default ({navigation, patientState, date}) => {

const handlePressItem = () => {
if (!canEdit(date)) return navigation.navigate('too-late', {date});
logEvents.logFeelingEditButtonClick();
handleEdit('day-survey');
};

Expand Down
3 changes: 3 additions & 0 deletions src/scenes/survey/daySurvey.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ const DaySurvey = ({navigation, route}) => {
};
setDiaryData(currentSurvey);
logEvents.logFeelingAdd();
logEvents.logFeelingAddComment(
Object.keys(answers).filter((key) => answers[key].userComment)?.length,
);

if (route.params?.redirect) {
alertNoDataYesterday({
Expand Down
18 changes: 18 additions & 0 deletions src/services/logEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ const logFeelingAdd = async () => {
});
};

const logFeelingAddComment = async (value) => {
await logEvent({
category: FEELING,
action: 'FEELING_ADD_COMMENT',
name: 'comment',
value,
});
};

const logFeelingEditButtonClick = async () => {
await logEvent({
category: FEELING,
action: 'FEELING_EDIT_BUTTON_CLICK',
});
};

const PARAMETERS = 'PARAMETERS';
const REMINDER_ADD = 'REMINDER_ADD';
const REMINDER_CANCEL = 'REMINDER_CANCEL';
Expand Down Expand Up @@ -439,4 +455,6 @@ export default {
logDeleteNoteDiary,
logOpenPage,
logInputDrugSurvey,
logFeelingEditButtonClick,
logFeelingAddComment,
};

0 comments on commit cc1a36d

Please sign in to comment.