Conversation
need comment model
daniel-d-truong
left a comment
There was a problem hiding this comment.
looks good Pramith! just a couple of minor changes that i'd like, let me know if you have any questions about them!
| addLikedPost = async (postId) => { | ||
| this.props.likedPostList.push(postId); | ||
| let post = await getPostById(postId); | ||
| post.incrementScore(); // await? |
There was a problem hiding this comment.
await shouldn't be necessary UNLESS you want to wait for the "this.push()" to finish being executed in the incrementScore method. I don't think it'll be necessary though since it'll be faster if we let the two updates to Firebase happen at the same time (feel free to delete the comment as well)
There was a problem hiding this comment.
Unrelated to implementation but what do you think about having each post collect the users that like a post (I believe we could do this implementation wise by adding a user_list to post) but do you think we should do that or is it better to make likes anonymous (maybe we can ask the team about this too)
There was a problem hiding this comment.
I think collecting the users that like a post would be a good idea. It's easy to implement and offers us more options in the future so I think it's a good idea
|
|
||
| getInstructorList() { | ||
| return this.props.instructorList; | ||
| return this.props.instructorList.slice(1, this.props.instructorList.length); |
There was a problem hiding this comment.
What was the purpose of this change?
There was a problem hiding this comment.
Rohith said that he and Pawan were going to initialize each list with a dummy string element to make sure Javascript knew that the list was a list of Strings. They wanted the list getters implemented this way to ignore that first dummy string
There was a problem hiding this comment.
Oh interesting okay I must not have caught that in a previous PR. Honestly that shouldn't be necessary but that could also be a refactor for later. Let's make a comment or something about that in the code to prevent future confusion.
| await this.push(); | ||
| } | ||
|
|
||
| addLikedPost = async (postId) => { |
There was a problem hiding this comment.
In a future PR let's write tests for these to make sure that they work
| const courseObj = await course.getCourseById(courseUUID); | ||
|
|
||
| if (courseObj.getInstructorList().indexOf(userObj.getUUID()) != -1) { | ||
| res.status(200).send("Instructor"); // send something else?? |
There was a problem hiding this comment.
(nitpick) Delete the comments
daniel-d-truong
left a comment
There was a problem hiding this comment.
Solid work! I am having issues running the routes though so let's sync up sometime today before merging and see why that's happening (I assume it worked on your end?)
daniel-d-truong
left a comment
There was a problem hiding this comment.
lgtm! just do last quick change on what the route sends and then feel free to merge
added user likes stuff and user/courseID routes