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

App is crashing after clicking on individual of type student #1110

Closed
AchalaBelokar opened this issue Sep 26, 2023 · 12 comments
Closed

App is crashing after clicking on individual of type student #1110

AchalaBelokar opened this issue Sep 26, 2023 · 12 comments
Assignees
Labels

Comments

@AchalaBelokar
Copy link

Describe the bug
After login select subject type student
Click on any student
Login Id : utkarsh@lahi

To Reproduce
1.login with utkarsh@lahi
2. click n search
3. click on student subject type
4. click on any student

Expected behavior
user is able to see the student details

Screenshots

az_recorder_20230926_132538.1.mp4
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Sep 26, 2023
@mahalakshme mahalakshme moved this from New Issues to Ready in Avni Product Sep 26, 2023
@mahalakshme mahalakshme removed the 5.0.0 label Sep 26, 2023
@mahalakshme
Copy link
Contributor

@AchalaBelokar whenever u can add the logs for these kind of crash issues, add them - we ll know the issue better

@mahalakshme mahalakshme moved this from Ready to In Analysis in Avni Product Sep 26, 2023
@mahalakshme mahalakshme moved this from In Analysis to Ready in Avni Product Sep 26, 2023
@AchalaBelokar
Copy link
Author

"Log error content:
TypeError: Cannot read property 'getLineage' of null

This error is located at:
in IndividualProfile"

@mahalakshme
Copy link
Contributor

mahalakshme commented Sep 26, 2023

looks like same error logs as of #1108 - might be duplicate - anyways need to be verified.

@himeshr
Copy link
Contributor

himeshr commented Sep 26, 2023

looks like same error logs as of #1108 - might be duplicate - anyways need to be verified.

No, this is a different issue not related to avniproject/avni-server#1108

Rather, it might be caused due to newly introduced AddressLevel.calculateLineage() method in avni-server repo

@himeshr himeshr self-assigned this Sep 26, 2023
@himeshr himeshr moved this from Ready to In Progress in Avni Product Sep 26, 2023
@himeshr
Copy link
Contributor

himeshr commented Sep 26, 2023

The cause of this issue is that:

  1. "Student" SubjectType doesnot have "Should sync by location" enabled for it, but rather has the "Sync by Direct Assignment" enabled.
  2. So during sync, Students assigned to a User will be synced regardless of whether the Student's address falls within the catchment.
  3. And this results in addressLevel being null for such Student's
  4. Later, when the user clicks on such a subject (Student whose address is not in User's catchment), app breaks with error "TypeError: Cannot read property 'getLineage' of null"

The fix for this, is to ensure that

  • org adminstrators only assign Subjects to a User who falls within their catchment OR
  • org adminstrators enables "Should sync by location" flag for the SubjectType

@himeshr himeshr closed this as completed Sep 26, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Avni Product Sep 26, 2023
@vinayvenu
Copy link
Member

@himeshr @mahalakshme lets discuss this during standup.

There is no way for the person assigning to ever know that they cannot be assigned. This might need to be a rule we should enforce to prevent such errors. I am thinking of two things

@vinayvenu vinayvenu reopened this Sep 27, 2023
@github-project-automation github-project-automation bot moved this from Done to Triaged in Avni Product Sep 27, 2023
@himeshr himeshr moved this from Triaged to Hold in Avni Product Sep 27, 2023
@himeshr
Copy link
Contributor

himeshr commented Sep 27, 2023

After discussion, we'll do the following fix in Product.

During Subject assignment to a User:

  • Add check to ensure Subject lies within User's catchment
  • Add unit test for presence of GroupSubject and MemberSubjects within User's catchment

Additionally, we'll be making suitable modifications in Prod implementations, to enable "Sync By Location" where-ever its not enabled, as that's a primary requirement in current version of Avni-client.

@himeshr himeshr moved this from Hold to In Progress in Avni Product Sep 27, 2023
@mahalakshme mahalakshme moved this from In Progress to Ready in Avni Product Sep 27, 2023
@mahalakshme mahalakshme moved this from Ready to In Analysis in Avni Product Sep 27, 2023
@mahalakshme mahalakshme moved this from In Analysis to Focus Items in Avni Product Sep 27, 2023
himeshr added a commit to avniproject/avni-server that referenced this issue Sep 27, 2023
Add check to ensure subject is within User's catchment during direct its assignment to the User
himeshr added a commit to avniproject/avni-server that referenced this issue Sep 27, 2023
Minor refactoring of UserSubjectAssignmentServiceTest initialization
@himeshr himeshr moved this from Focus Items to Code Review Ready in Avni Product Sep 27, 2023
@vinayvenu vinayvenu moved this from QA Ready to In QA in Avni Product Sep 28, 2023
@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Oct 3, 2023
@himeshr
Copy link
Contributor

himeshr commented Oct 6, 2023

The check we have added, disallows sync of directly assignable "Member" subjectTypes that have different
"Location type where this subject can be registered" in-comparison to their Group subjectTypes.
Ex: LAHI org, KarigarBatch(District) and Student(UDISE)..

Fix:

Check for "Member" subjectTypes address falling within the user's catchement, fetching seperately the Address levels for each subjectType

We should not check for "Member" subjectTypes address is within the user's catchement.

QA task:

The "Direct subject assignment to User" for a GroupSubject should work, even when the GroupSubject RegistrationLocationType is higher than MemberSubject RegistrationLocationType

@himeshr himeshr reopened this Oct 6, 2023
@github-project-automation github-project-automation bot moved this from Done to Triaged in Avni Product Oct 6, 2023
@himeshr himeshr moved this from Triaged to Hold in Avni Product Oct 6, 2023
himeshr added a commit to avniproject/avni-server that referenced this issue Oct 9, 2023
Need not check for presence of memberSubject within the catchment while assigning groupSubjects to a user
@himeshr himeshr moved this from Hold to Code Review Ready in Avni Product Oct 9, 2023
@petmongrels petmongrels moved this from Code Review Ready to In Code Review in Avni Product Oct 9, 2023
@petmongrels petmongrels moved this from In Code Review to QA Ready in Avni Product Oct 9, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to Done in Avni Product Oct 9, 2023
@mahalakshme
Copy link
Contributor

mahalakshme commented Oct 18, 2023

We are not showing the error when the subject/group subject is assigned to an out of catchment user via checkbox selection and we are showing error only assigment done via Actions. This card released as part of 5.0.0 but we can fix this as part of 5.1.0

@mahalakshme mahalakshme reopened this Oct 18, 2023
@github-project-automation github-project-automation bot moved this from Done to Triaged in Avni Product Oct 18, 2023
@mahalakshme mahalakshme moved this from Triaged to QA Failed in Avni Product Oct 18, 2023
@himeshr himeshr moved this from QA Failed to In Progress in Avni Product Oct 20, 2023
himeshr added a commit to avniproject/avni-webapp that referenced this issue Oct 20, 2023
@himeshr himeshr moved this from In Progress to Code Review Ready in Avni Product Oct 20, 2023
@himeshr
Copy link
Contributor

himeshr commented Oct 20, 2023

Attached screenshot of error being surfaced when subject/group subject is assigned to an out of catchment user via checkbox selection.

Screen.Recording.2023-10-20.at.11.20.56.AM.mov

@ashusvnath ashusvnath moved this from Code Review Ready to In Code Review in Avni Product Oct 23, 2023
@ashusvnath
Copy link

I've put a comment on the code, but it is non-blocking, moving this story to qa ready.

@ashusvnath ashusvnath moved this from In Code Review to QA Ready in Avni Product Oct 23, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Oct 25, 2023
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Oct 26, 2023
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Oct 26, 2023
@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

5 participants