Skip to content
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

Project Retrieval endpoints return Likes #336

Merged
merged 11 commits into from
Dec 7, 2020

Conversation

Brend-Smits
Copy link
Member

@Brend-Smits Brend-Smits commented Dec 5, 2020

Description

Likes were not being returned when retrieving projects. Due to performance reasons, we are just returning an array for now with user id + date instead of Like Count and boolean to check if the currently logged-in user has liked that specific project.
In the future, we should probably move the like and follow things into their own controller with respective services. The frontend can then make a call to retrieve project metadata, which can take a little longer and should be non-blocking for the frontend.
For now, the frontend can count the objects in the likes array and check if a user-id is equal to the one that is logged in.
Fixes #329.

#335 should be merged before this as I merged that branch in this one to investigate performance while retrieving likes.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I did not update API Controllers, if I did, I added/changed Postman tests
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I updated the changelog with an end-user readable description
  • I assigned this pull request to the correct project board to update the sprint board

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.
These steps will be used during release testing.

  1. Make a call to project overview.
  2. Check if object returns likes (make sure you add likes into DB)

Link to issue

Closes: #329

Joining the tables by using Include() caused the query to take sometimes up to 10 times as long. This was an issue as it caused drastic slow down when retrieving all projects, retrieving project detail or when searching for projects.
Likes were not being returned when retrieving projects. Due to performance reasons, we are just returning an array for now with user id + date instead of Like Count and boolean to check if currently logged in user has liked that specific project. 
In the future we should probably move the like and follow  things into their own controller with respective services. The frontend can then make a call to retrieve project meta data, which can take a little longer and should be non-blocking for the frontend. 
For now, the frontend can count the objects in the likes array and check if a user id is equal to the one that is logged in.
Fixes #329.
@Brend-Smits Brend-Smits changed the title Add Collaborators by performing for each loop instead of joining tables Project Retrieval endpoints return Likes Dec 5, 2020
@Brend-Smits
Copy link
Member Author

Integration check is failing based on performance external wizard call, just FYI

waltersajtos
waltersajtos previously approved these changes Dec 7, 2020
Copy link
Member

@RubenFricke RubenFricke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks really clean. I'm sorry to nitpick, but in your documentation, you sometimes end the sentence with a dot, and sometimes you don't do this. According to the code guidelines
End comment text with a period. I suggest do end it with a dot all the time (if it's a correct sentence. On my first PR I got some great discussion about this, and we decided to only end the sentence with a dot whenever it's a correct sentence.)

Repositories/ProjectRepository.cs Outdated Show resolved Hide resolved
@Brend-Smits Brend-Smits merged commit 2335f64 into develop Dec 7, 2020
@Brend-Smits Brend-Smits deleted the feature/329-improved-project-likes branch December 7, 2020 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return project likes on the getProject endpoints
3 participants