openMF / web-app

Mifos X Web App is the revamped version of the Mifos X Community App built on top of the Fineract Platform leveraging the popular Angular framework.
https://openmf.github.io/web-app/
Mozilla Public License 2.0
226 stars 511 forks source link

unable to add a survey to the client #1324

Closed bharathcgowda closed 2 years ago

bharathcgowda commented 3 years ago

Description

unable to add a survey to the client

Steps to Reproduce

  1. first create a basic survey at admin->system->manage surveys
  2. go to institution->client and select any client
  3. in client screen go to more and click on survey
  4. click on take survey and select a survey
  5. now submit the survey

Expected Behaviour

user should be able to submit the survey successfully

Screenshots, if any

image

pesoseliza commented 3 years ago

After inspecting the errors produced by the submit button I found that the first error produced would be solved by an Access-Control-Allow-Origin header. This error is produced when the browser refuses access to a remote resource which usually happens when trying to execute a cross domain request. There is also a chrome extension that can be used to fix this error temporarily which is what I used. The second error was a POST 500 error which is caused by the api and cannot be fixed from the client end. I would suggest revising the api or using an api with different information to see if you receive a different outcome.

Screen Shot 2021-04-13 at 9 13 20 PM Screen Shot 2021-04-13 at 8 40 27 PM Screen Shot 2021-04-15 at 8 06 37 PM
bharathcgowda commented 3 years ago

thank you for the analysis and detailed explanation @elizamota, @BLasan will you be able to look into this issue once?

BLasan commented 3 years ago

thank you for the analysis and detailed explanation @elizamota, @BLasan will you be able to look into this issue once?

Sure

BLasan commented 3 years ago

@bharathcgowda I think this is not an issue with the server. I tried the same surveys as in @elizamota 's Screenshots. But I'm not getting any issues. I think this needs to be fixed in the front-end. No issues with the released version of Mifos (Community-App). Try the same scenarion using the host https://dev.mifos.io

pesoseliza commented 3 years ago

Both @bharathcgowda and I were on the local host when the error appeared so it could just be the Access-Control-Allow-Origin header. If you tried the same scenario on the local host it would produce the error from the original issue. Since it doesn't seem to affect https://dev.mifos.io its probably not a big problem.

BLasan commented 3 years ago

@bharathcgowda @elizamota Screenshot from 2021-04-19 18-14-44

Screenshot from 2021-04-19 19-35-19

JemCdo commented 3 years ago

@BLasan @elizamota @bharathcgowda I had a same issue today on https://github.com/openMF/web-app but then I switched to https://github.com/openMF/community-app/ and everything is working fine on same same server as tested by @BLasan

bharathcgowda commented 3 years ago

Right,thank you for testing this @JemCdo.

We have to fix the issue on the web-app project as well.

CesarCrZy commented 3 years ago

I´ve found the issue under src/app/clients/clients-view/clients-actions/take-survey/take-survey.component.ts

The way to get clientId is wrong, so when the request send, clientId is undefined, the parameter for get that id should be this.route.parent.snapshot.paramMap.get("clientId"); but its written this.route.parent.parent.snapshot.paramMap.get("clientId");

bharathcgowda commented 3 years ago

Hi @CesarCrZy thank you for finding the root cause, will you be able send a PR for the same?

CesarCrZy commented 3 years ago

Sure!

ramvr1256 commented 2 years ago

The issue is blocked due to API failure. Fineract ticket is raised https://issues.apache.org/jira/browse/FINERACT-1636