web-app
web-app copied to clipboard
unable to add a survey to the client
Description
unable to add a survey to the client
Steps to Reproduce
- first create a basic survey at admin->system->manage surveys
- go to institution->client and select any client
- in client screen go to more and click on survey
- click on take survey and select a survey
- now submit the survey
Expected Behaviour
user should be able to submit the survey successfully
Screenshots, if any
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.



thank you for the analysis and detailed explanation @elizamota, @BLasan will you be able to look into this issue once?
thank you for the analysis and detailed explanation @elizamota, @BLasan will you be able to look into this issue once?
Sure
@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
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.
@bharathcgowda @elizamota
@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
Right,thank you for testing this @JemCdo.
We have to fix the issue on the web-app project as well.
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");
Hi @CesarCrZy thank you for finding the root cause, will you be able send a PR for the same?
Sure!
The issue is blocked due to API failure. Fineract ticket is raised https://issues.apache.org/jira/browse/FINERACT-1636