Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

feat(projects): #1594 filtered the public projects having > 1 repo #1598

Open
wants to merge 5 commits into
base: v0.11.9
Choose a base branch
from

Conversation

webkhushboo
Copy link
Contributor

@webkhushboo webkhushboo commented Nov 4, 2019

closes #1594

Notes

A summary of what was achieved in this PR

  • UI: Display public projects if having more than 1 repository

image

@webkhushboo webkhushboo changed the title feat(projects): #1579 filtered the public projects having > 1 repo feat(projects): #1594 filtered the public projects having > 1 repo Nov 4, 2019
@webkhushboo
Copy link
Contributor Author

webkhushboo commented Nov 4, 2019

@eddiejaoude

I have tagged the wrong issue in the commit 7ce1111

Please squash commit while merge. if possible . It would be really helpful

@@ -40,7 +40,8 @@ export class PrivatePublicProjectComponent implements OnInit, OnDestroy {
if (this.router.url === '/') {
this.projectSubscription = this.projectService
.findPublicProjects()
.subscribe((projects: IProject[]) => this.projects = projects.map((project: IProject) => new ProjectModel(project)));
.subscribe((projects: IProject[]) => this.projects = projects.map((project: IProject) => new ProjectModel(project))
.filter((project: ProjectModel) => project.repositories.length > 0));
Copy link
Contributor

Choose a reason for hiding this comment

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

When the list get longer in the future it would be more efficient to get the database to do the filtering if possible.

Currently the query limits to 10 results, if we remove items after the query we could end up with less than 10

ref.where('type', '==', 'public')
              .orderBy('updatedOn', 'desc').limit(10)

Copy link
Contributor

Choose a reason for hiding this comment

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

It does not look like it is possible to do a repositories.length > 0 query in Firestore. We would need to store the repositories count to do this.

Best to store the repository length, so we can do a query to Firestore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay Do I have to make this change in this issue ? or we can do it in another ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think do it in this PR, as this PR is tiny

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay I will do it here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On homepage, only show projects in the public project list if they have at least 1 repository
2 participants