Hi,
I’m trying to solve the “Delete Comments” ticket.
My unit tests are all OK, but when I go to the status page, I get the following error: “Delete Comments: g.json.comments is undefined”.
Please help me solve this issue.
Thank you,
Rémy
Hi,
Here is my status page. I have 2 issues (see open issue Chapter 2: Ticket: Create/Update Comments)
Thank you
Hi @imremy,
There is a front-end validation unhandled exception, that we are about to fix, but the error that you are encountering is due to some issue in your getMovie
implementation.
I cannot seem to reproduced this though.
N.
As @Norberto said, there is a problem in the front end validation, but it can be fixed by adding the comments to the response payload even if the comment isn’t deleted:
MoviesService.java
public boolean deleteMovieComment(
String movieId, String email, String commentId, Map<String, Object> results) {
if (!commentDao.deleteComment(commentId, email)) {
results.put(
"error",
MessageFormat.format("user `{0}` cannot delete comment `{1}`", email, commentId));
Movie movie = MovieDocumentMapper.mapToMovie(movieDao.getMovie(movieId));
results.put("comments", movie.getComments());
return false;
}
Movie movie = MovieDocumentMapper.mapToMovie(movieDao.getMovie(movieId));
results.put("comments", movie.getComments());
return true;
}
This should be fixed in the front-end, but in the mean time it will help you progress
Greetings!
I’m getting error “Delete Comments: Cannot read property ‘0’ of undefined”, even though all tests pass.
same here, any fix will help in ui validations?
Hi @nicomv, thanks for your help, but I’m still getting an error: “Delete Comments: Deletion was performed but unsuccessful”. When debugging the code, I see that the comments that are deleted don’t match the ones that were inserted (different _id), so the comment can’t be deleted.
When I implemented this hack, the error message on the “status” page changed from original:
"Delete Comments: Cannot read property ‘0’ of undefined"
to:
"Delete Comments: Deletion was performed but unsuccessful"
So still no luck for me. Oh crap.
Hi there,
Make sure that you using the correct type for fieldcommentId
in the delete method!
N.
I am getting the following error ‘Delete Comments: Unable to retrieve movie comments’
Do you sort the comments descending by date?
I missed to add the sort statement for ordering by descending date at MovieDao.getMovie and it went thru until i got errors at creating/updating/deleting comments.
Once I went back and add the statement it worked! Thanks for the hint @steevej-1495 !
HI Team, i am not getting validation codes for comments(UpdateCreateComment/Detele/Get) .Please help me out in this.
If the error messages you get are the same as the one from this thread, please apply the same solution. Otherwise start a new thread and provide error messages. Nobody can help you if you do not provide the error messages.