-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add comments feature #30
Conversation
portfolio/src/main/java/com/google/sps/servlets/CommentServlet.java
Outdated
Show resolved
Hide resolved
I have merged another walkthrough's PR with this one since this PR is somewhat small. I hope that's okay! |
portfolio/src/main/java/com/google/sps/servlets/ListCommentsServlet.java
Show resolved
Hide resolved
portfolio/src/main/java/com/google/sps/servlets/ListCommentsServlet.java
Outdated
Show resolved
Hide resolved
Reminder to self: add final keyword to variables where possible |
…ServerPostWalkthrough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try adding this https://github.com/github/gitignore/blob/master/Java.gitignore to your .gitignore so you don't commit Java bytecode and other binaries you ended up adding to this PR.
portfolio/src/main/java/com/google/sps/servlets/CommentServlet.java
Outdated
Show resolved
Hide resolved
portfolio/src/main/java/com/google/sps/servlets/CommentServlet.java
Outdated
Show resolved
Hide resolved
portfolio/src/main/java/com/google/sps/servlets/DataServlet.java
Outdated
Show resolved
Hide resolved
portfolio/src/main/java/com/google/sps/servlets/DeleteCommentServlet.java
Show resolved
Hide resolved
portfolio/src/main/java/com/google/sps/servlets/ListCommentsServlet.java
Outdated
Show resolved
Hide resolved
I see what you mean, sorry I should've caught that! That has been added to my .gitignore but I need to do a git remove cache to make git acknowledge the changes on my .gitignore and stop tracking the folders I've put in it. Thanks! |
I just did a lot of refactoring especially breaking up functions because it seemed like I didn't pay enough attention to the single responsibility principle last week. I've also implemented Gui's suggestions, thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Just added some "FYI" comments.
LGTM
private void deleteAll(DatastoreService datastore, PreparedQuery results) { | ||
for (Entity entity : results.asIterable()) { | ||
Key entityKey = entity.getKey(); | ||
datastore.delete(entityKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I mentioned to Austin that there's an overloading of this method that accepts java.lang.Iterable<Key>
as parameter, so you could remove all those values with a single call, but that would involve casting results.asIterable()
into java.lang.Iterable<Key>
(stream().map() is a neat way of doing that), but that might be too much work here and end up being not worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into this towards the end of the week as I want to do some refactoring. I've created an issue so I won't forget about this #36 Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gbuenoandrade
Hi, this is what I have so far:
private void deleteAll(DatastoreService datastore, PreparedQuery results) {
Iterable<Key> toDelete = (results.asIterable()).stream().map(entity -> {
return entity.getKey();
}).collect(Collectors.toList());
datastore.delete(toDelete);
}
but it seems that .stream()
is undefined for the type Iterable<Entity>
and I am not familiar with any other alternatives. Do you have anything in mind?
portfolio/src/main/java/com/google/sps/servlets/ListCommentsServlet.java
Show resolved
Hide resolved
Code looks ok. Just some comments about PR scope, to follow up on discussion today.
|
Assigned @gbuenoandrade just for the follow up on #30 (comment) |
I have coded a simple comments form into the website, the text typed into the box will be saved into a List structure and then contents in the List is returned right below the comment box.