UNIQUE Attributes should block the entry of duplicated TEIs after online search

Description

Description

Imagine two users (UserA - right, UserB-left)
UserA has created a TEI on the system and has synchronized it. It contains the UNIQUE attribute 0011.


UserB decides to create a new TEI (the same 0011) as they are not aware that the TEI might have already been created so they perform the search


They ignore the results and decide to create the TEI with 0011 by clickin on the button

The UserB will never be able to send the TEI 0011 (which is correct) as it already exists on the server. However, the App should have blocked the insertion as a search was performed even though the TEI was not downloaded.

Requirements

  • Do not copy unique attributes from search to enrollment form when creating a new TEI

  • In the enrollment form, when a unique attribute is changed, perform an online search (if connection available) to check if the value is in used in the server and the uniqueness in the system/orgunit is fullfill.

Acceptance Criteria

GIVEN a search by unique attribute
WHEN the user decides to create a new TEI
THEN do not copy searched unique attribute value to the form

GIVEN an enrollment form with unique attributes and an internet connection
WHEN the user changes the attribute value
THEN uniqueness will be checked using an online search (org unit included for unique in org unit, not needed for unique in system)

GIVEN an enrollment form with unique attributes and no internet connection
WHEN the user changes the attribute value
THEN uniqueness will be checked locally (org unit included for unique in org unit, not needed for unique in system)

Develop

 

Test

Server

serverUrl

Program

programName/programStage

Credentials

username/pass

Tests cases :

Possible side effects to take into account:

Attachments

6
  • 04 Feb 2022, 05:32 PM
  • 04 Feb 2022, 05:32 PM
  • 04 Feb 2022, 05:30 PM
  • 04 Aug 2021, 10:49 AM
  • 04 Aug 2021, 10:48 AM
  • 04 Aug 2021, 10:46 AM

Activity

Show:

Nancy Espinoza March 28, 2022 at 9:38 PM

got it, thanks!

Nancy Espinoza February 28, 2022 at 4:30 PM

Fixed in 2.6 (25/02)

Pablo Pajuelo February 9, 2022 at 8:29 AM

Flag removed

I could reproduce it.
Check the SearchRepositoryImpl.java class lines 255-260.
We are not storing attributes marked as generated but we are with those marked as unique.
I think we should check there if the unique value exist before trying to save it.

Nancy Espinoza February 4, 2022 at 5:32 PM

After the search, the unique attributes were copied to the enrollment form

User A

User B

Tested in android-current
users android1, android2

Al-Gassim Sharaf Addin August 4, 2021 at 5:45 PM

Jira issue mentioned in the Community of Practice: https://community.dhis2.org/t/using-android-dhis-2capture-online/43789

Thanks !

Done

Details

Assignee

Reporter

Internal feature

General interest

Fix versions

Components

Priority

Sentry

Created August 4, 2021 at 12:00 PM
Updated May 6, 2022 at 8:05 AM
Resolved February 28, 2022 at 4:31 PM