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

Managing direct assignments of individual to user #663

Closed
mahalakshme opened this issue Nov 24, 2023 · 16 comments
Closed

Managing direct assignments of individual to user #663

mahalakshme opened this issue Nov 24, 2023 · 16 comments
Assignees

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Nov 24, 2023

https://avni.freshdesk.com/a/tickets/3263

Current scenario:

Currently individual unable to assign to a user (avniproject/avni-client#1058). They are assigned via group assignment. But we should be able to assign individuals also to user.

Premise:

Individual assignment to users should be possible independent of group assignment to the users, since the group that the individual belongs to might change or identified at a later point of time.

Acceptance criteria:

  • Able to assign individual to a user
  • When a assigned individual to a user, is added to group not assigned to a user, group should not be synced and individual should be synced
  • When a group is assigned to a user, like now assign all individuals in the group to the user - already done but make sure to retain the behaviour
  • When a new member added to a group assigned to a user, the member should be assigned to the user - already done but make sure to retain the behaviour
  • When a group is unassigned from the user, individuals in the group should continue to remain assigned to the user
  • When a individual is tried to unassign from a user, but group in which individual belongs to is assigned to the user, user should not be able to do this and get a error message that states 'individualName{say Arun} cant be unassigned from the userName{say Rahul}, since group, groupName{say Class12} that individualName{say Arun} belongs to, is assigned to the userName{say Rahul}.
  • On bulk unassignment, when some of the individuals has above issue, do not save any of them. Collate the errors and display.

Corner Test cases:

  • Say a individual is assigned to a user, and then a group that individual belongs to is assigned to the user - should work without failing
  • On bulk assign of individuals to a list of users(where some have the individual already assigned) - should work
@mahalakshme mahalakshme converted this from a draft issue Nov 24, 2023
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Nov 29, 2023
@mahalakshme mahalakshme changed the title Make sure Group and individual same catchment Managing direct assignments of individual to user Nov 29, 2023
@mahalakshme mahalakshme moved this from In Analysis Review to In Analysis in Avni Product Nov 30, 2023
@mahalakshme mahalakshme moved this from In Analysis to Ready in Avni Product Nov 30, 2023
@petmongrels petmongrels moved this from Ready to In Progress in Avni Product Dec 1, 2023
@petmongrels petmongrels self-assigned this Dec 1, 2023
@petmongrels petmongrels moved this from In Progress to Ready in Avni Product Dec 1, 2023
@petmongrels petmongrels removed their assignment Dec 1, 2023
@himeshr himeshr moved this from Ready to In Progress in Avni Product Dec 4, 2023
@himeshr himeshr self-assigned this Dec 4, 2023
@himeshr
Copy link
Contributor

himeshr commented Dec 4, 2023

Code changes done so far:

  • Individual assignment to users should be possible independent of group assignment to the users, since the group that the individual belongs to might change or identified at a later point of time.
  • Able to assign individual of group as well as non-group subject-type to a user directly
  • When a assigned individual to a user, is added to group not assigned to a user, group should not be synced and individual should be synced
  • When a group is assigned to a user, like now assign all individuals in the group to the user - already done but make sure to retain the behaviour
  • When a new member added to a group assigned to a user, the member should be assigned to the user - already done but make sure to retain the behaviour
  • When a group is unassigned from the user, individuals in the group should continue to remain assigned to the user
  • When a individual is tried to unassign from a user, but group in which individual belongs to is assigned to the user, user should not be able to do this and get a error message that states 'individualName{say Arun} cant be unassigned from the userName{say Rahul}, since group, groupName{say Class12} that individualName{say Arun} belongs to, is assigned to the userName{say Rahul}.
  • On bulk unassignment, when some of the individuals has above issue, do not save any of them. Collate the errors and display.

Corner Test cases:

  • Say a individual is assigned to a user, and then a group that individual belongs to is assigned to the user - should work without failing
  • On bulk assign of individuals to a list of users(where some have the individual already assigned) - should work
  • Say a group is assigned to an User, where atleast one of the member is not within the User's catchment, the group and member's within the User's catchment should get synced to the User without any failures(Association errors).

himeshr added a commit that referenced this issue Dec 11, 2023
…roup should continue to remain assigned to the user
himeshr added a commit that referenced this issue Dec 11, 2023
…allow removal of members when group is still assigned to user.
himeshr added a commit that referenced this issue Dec 11, 2023
@himeshr
Copy link
Contributor

himeshr commented Dec 11, 2023

Dev testing screen recordings are attached here-in:

PartialSuccessOfBulkUnassignment.mov
ErrorWhileRemovingMemberWhenGroupIsStillAssigned.mov

@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Dec 11, 2023
@petmongrels petmongrels moved this from Code Review Ready to In Code Review in Avni Product Dec 12, 2023
@mahalakshme
Copy link
Contributor Author

@petmongrels are you reviewing this?

@himeshr himeshr moved this from In Code Review to Code Review with Comments in Avni Product Dec 12, 2023
@himeshr
Copy link
Contributor

himeshr commented Dec 12, 2023

When a non-group individual is assigned to a user, but its group is not assigned to the same user, we will get error in client during sync, as it would not find the related Group entity.
As a fix, throw an exception of type IgnorableSyncError and handle the same during persist to ingore only those specific entities.

@himeshr himeshr moved this from Code Review with Comments to In Progress in Avni Product Dec 12, 2023
himeshr added a commit to avniproject/avni-models that referenced this issue Dec 12, 2023
…hrown when association error failures are to be ignored
himeshr added a commit to avniproject/avni-models that referenced this issue Dec 12, 2023
…able to find groupOrHousehold when syncing groupSubject mapping objects
himeshr added a commit to avniproject/avni-models that referenced this issue Dec 12, 2023
himeshr added a commit that referenced this issue Dec 12, 2023
…roup should continue to remain assigned to the user

(cherry picked from commit c1462fc)
himeshr added a commit that referenced this issue Dec 12, 2023
…allow removal of members when group is still assigned to user.

(cherry picked from commit 38e5b4e)
@himeshr
Copy link
Contributor

himeshr commented Dec 13, 2023

  • we throw error Individual (%s) cant be unassigned from the user (%s), since group (%s) that the member (%s) belongs to, is assigned to the user (%s)

@mahalakshme and @vinayvenu
This is also supported in the current version of code. Resolved the doubt on call with Vivek.
Moving to QA Ready.

@himeshr himeshr moved this from Code Review with Comments to QA Ready in Avni Product Dec 13, 2023
himeshr added a commit to avniproject/avni-models that referenced this issue Dec 15, 2023
…SyncError, as GroupSubject mappings will be synced based on groupOrHouseholdSubject and doesnot filter on MemberSubject's presence within the catchment
@himeshr
Copy link
Contributor

himeshr commented Dec 15, 2023

@petmongrels Have done this additional commit, because, for the case where Household is within the User's catchment but a Member isn't we would have ended up with a sync error, as we do not (and cannot) check for GroupSubjectMapping -Member being within catchment during syncable items determination on server.

Related test-case:
Say a group is assigned to an User, where atleast one of the member is not within the User's catchment, the group and member's within the User's catchment should get synced to the User without any failures(Association errors).

himeshr added a commit to avniproject/avni-client that referenced this issue Dec 15, 2023
himeshr added a commit to avniproject/avni-webapp that referenced this issue Dec 15, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Dec 18, 2023
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Dec 18, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Dec 18, 2023
@AchalaBelokar
Copy link

AchalaBelokar commented Dec 18, 2023

  • Created a student which is not part of any group and assign and unassigned to the user. it is working properly
  • Then created a student which is part of one group and then I assigned that group to user and try to unassigned that user it through the error
  • Able to assign individual of group as well as non-group subject-type to a user directly
  • When a assigned individual to a user, is added to group not assigned to a user, group should not be synced and individual should be synced
  • When a group is unassigned from the user, individuals in the group should continue to remain assigned to the user

@AchalaBelokar
Copy link

  • I am trying to assign single student to the user it is showing me this error.
Screen.Recording.2023-12-18.at.4.47.21.PM.mov

@himeshr can you look at this

himeshr added a commit to avniproject/avni-webapp that referenced this issue Dec 18, 2023
…licking on a username to perform assignment / un-assignment
@himeshr
Copy link
Contributor

himeshr commented Dec 18, 2023

  • I am trying to assign single student to the user it is showing me this error.

Screen.Recording.2023-12-18.at.4.47.21.PM.mov
@himeshr can you look at this

I have added debounce to avoid invoking the backend api repeatedly when user keeps clicking on a username.
Should work fine once the webapp fix is deployed.

himeshr added a commit to avniproject/avni-webapp that referenced this issue Dec 19, 2023
@Dinesh2019
Copy link

1.Taking time to select the assigned to user
2.If we select the user in the assigned to and select the check box under name it is getting refreshed the assign to or remove the user from the assign to

Screen.Recording.2023-12-19.at.11.56.01.AM.mov

@himeshr
Copy link
Contributor

himeshr commented Dec 19, 2023

1.Taking time to select the assigned to user 2.If we select the user in the assigned to and select the check box under name it is getting refreshed the assign to or remove the user from the assign to

Screen.Recording.2023-12-19.at.11.56.01.AM.mov

@Dinesh2019 Create a separate bug, the Individual is correctly assigned / unassigned from the user the first time around.
Its just that on clicking the checkbox, it gets reset to initial state.

@Dinesh2019
Copy link

@himeshr created the bug card avniproject/avni-webapp#1106

@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Dec 20, 2023
himeshr added a commit that referenced this issue Dec 20, 2023
…t and group_subject to ensure missed out entities are synced
@himeshr
Copy link
Contributor

himeshr commented Dec 20, 2023

@AchalaBelokar, we've made an additional commit related to this card. To update the last modified date time for all UserSubjectAssignment and GroupSubject entities.

Therefore, please perform another round of testing for LAHI org DirectSubjectAssignment to User feature,

  1. for catchments where there is missing Students for a KarigarBatch
  2. for multiple users with different catchments
  3. with old and new prerelease apks

@himeshr himeshr reopened this Dec 20, 2023
@github-project-automation github-project-automation bot moved this from Done to Triaged in Avni Product Dec 20, 2023
@himeshr himeshr moved this from Triaged to QA Ready in Avni Product Dec 20, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Dec 21, 2023
@AchalaBelokar
Copy link

AchalaBelokar commented Dec 21, 2023

  • Assign individual to user
  • Assign group individual to user which contain user
  • Assign group which is not part of catchment
  • Assign individual which is not a part of user catchment
  • Add individual to the group where the individual and group are already assign to that user
  • add individual to the group where the individual and group are already assign to that user then remove the user from group and sync
  • When a assigned individual to a user, is added to group not assigned to a user, group should not be synced and individual should be synced
  • When a group is unassigned from the user, individuals in the group should continue to remain assigned to the user
  • When a individual is tried to unassign from a user, but group in which individual belongs to is assigned to the user, user should not be able to do this and get a error message
  • bulk unassignment
  • Say a individual is assigned to a user, and then a group that individual belongs to is assigned to the user
  • On bulk assign of individuals to a list of users(where some have the individual already assigned) - should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

6 participants