Skip to content

Commit

Permalink
Merge pull request #40 from rhanmiano/develop
Browse files Browse the repository at this point in the history
Develop to Master: Adjust number of followers and number of results to avoid query timeout
  • Loading branch information
rhanmiano committed Aug 23, 2023
2 parents 7625925 + 90bb8fa commit 79d41fd
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
22 changes: 14 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ That is all! Read the remaining sections of this document to get going.
#### Before anything else

- **Make sure that the feature is related to what The Starred PH aims to be.**
- If updates are to be made to the current top most starred Github repositories context, is the feature does not pivots to anything besides showing the most starred repositories, does it supplement the current behaviour?
- If it is from new platform(see ideas here), is the feature essential to promote our Pinoy developers, creatives and such?
- If updates are to be made to the current top most starred Github repositories context, does the feature not pivoting to anything besides showing the most starred repositories, does it supplement the current behaviour?
- If it is from new platform(see ideas [here](https://github.com/rhanmiano/the-starred-ph#whats-next)), is the feature essential to promote our Pinoy developers, creatives and such?
- **Do check the provided [template](https://github.com/rhanmiano/the-starred-ph/blob/master/.github/templates/ISSUE_TEMPLATE/feature_request.md) for feature requests** to see what are the needed details for the maintainer to consider your feature in mind.
- **Submit your feature request.**

Expand All @@ -67,12 +67,18 @@ That is all! Read the remaining sections of this document to get going.
**Note** I encourage first timers :beginner: (as I am new to Open Source also) to participate and unleash that inner nerd in you. You can read guides in **[here](https://www.firsttimersonly.com/)** on how to contribute to **[open source](https://opensource.guide/)** projects.

- After making sure that all has been read, **fork** this repo.
- `git clone your-forked-repo-in-here` Clone your forked repo in to your local machine.
- `git fetch && git checkout develop` The `develop` branch will be our starting point, to avoid breaking what's in the `master`
- `git remote add upstream https://github.com/rhanmiano/the-starred-ph.git` This will allow us to connect to the original remote repository.
- `git fetch upstream` To fetch upstream branches.
- `git branch --set-upstream-to=upstream/develop develop` To allow us to pull updates from the original remote **develop** branch.
- `git checkout -b ${prefix}/descriptive-branch-name-here` Checkout to your branch. Prefix it with `feature/` or `fix/`, whatever is applicable to your updates.
- Clone your forked repo in to your local machine. <br />
`git clone your-forked-repo-in-here`
- The `develop` branch will be our starting point, to avoid breaking what's in the `master` <br />
`git fetch && git checkout develop`
- This will allow us to connect to the original remote repository. <br />
`git remote add upstream https://github.com/rhanmiano/the-starred-ph.git`
- To fetch upstream branches. <br />
`git fetch upstream`
- To allow us to pull updates from the original remote **develop** branch. <br />
`git branch --set-upstream-to=upstream/develop develop`
- Checkout to your branch. Prefix it with `feature/` or `fix/`, whatever is applicable to your updates.
`git checkout -b ${prefix}/descriptive-branch-name-here`
- Code and push your changes.
- Submit a **pull request**. Please do follow the [template](https://github.com/rhanmiano/the-starred-ph/blob/master/.github/templates/PULL_REQUEST_TEMPLATE.md) for requesting one.

Expand Down
10 changes: 5 additions & 5 deletions content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Top 10 most starred Github repositories in the Philippines

## Context

In the ever growing horizon of people and set of technologies available in the development bubble nowadays, it can be a challenge for new Filipino devs to find inspiration and guidance.
In the ever growing horizon of people and set of technologies available in the development bubble nowadays, it can be a challenge for new Filipino devs to find inspiration and guidance.

The project aims to be a station for fellow Filipino developers and their projects to be highlighted, so that others may see it as well. This is also a great opportunity for starters, who might be curious, to see the various projects that other tech enthusiasts pursue during their free time and the frameworks they utilize.

Expand All @@ -26,11 +26,11 @@ This project is inspired by the following existing projects:

## How is the list being generated?

1. Fetch 100 most followed Github users with "philippines" & "+ph" indicated in their location.
2. Users/Orgs must have at least 10 followers.
3. List their top 10 repos based on stargazers count. (The project limits the list in to top 10 repositories only for now, and there's a possibility that a user's repositories may fill in one or more spot in the list)
1. Fetch first 50 most followed Github users/orgs with "philippines" & "+ph" indicated in their location.
2. Users must have at least 50 followers. Orgs must have at least 10 followers.
3. List their top 10 repos based on stargazers count. (The project limits the list in to top 10 repositories only for now)
4. Repository must be public, must be originally owned by the user and is not forked.
5. Merge all collected repos and sort those from highest stargazer count, and then get the top 10.
5. Merge all collected repos. Sort those from highest stargazer count. Should there be any duplicate by owner's id, retain the one with the highest stargazers count, and then get the top 10.

### Caveats

Expand Down
4 changes: 2 additions & 2 deletions gql/github/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const GET_REPOS_BY_USER = () => {
return {
query: `query
{
search(type: USER, query: "location:philippines location:+ph sort:followers-desc followers:>=10 type:user", first: 100) {
search(type: USER, query: "location:philippines location:+ph sort:followers-desc followers:>=50 type:user", first: 50) {
userCount
edges {
node {
Expand Down Expand Up @@ -58,7 +58,7 @@ export const GET_REPOS_BY_ORG = () => {
return {
query: `query
{
search(type: USER, query: "location:philippines location:+ph sort:followers-desc followers:>=10 type:org", first: 100) {
search(type: USER, query: "location:philippines location:+ph sort:followers-desc followers:>=10 type:org", first: 50) {
userCount
edges {
node {
Expand Down
38 changes: 29 additions & 9 deletions store/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,35 @@ export const actions = {

export const getters = {
topRepos(state) {
return state.topRepos && state.topRepos.length
? state.topRepos
: state.collectedRepos.length
? orderBy(
state.collectedRepos,
[(v) => v.stargazerCount],
['desc']
).slice(0, 10)
: []
if (state.topRepos?.length) {
return state.topRepos
}

if (state.collectedRepos?.length) {
const sortedData = orderBy(
state.collectedRepos,
[(v) => v.stargazerCount],
['desc']
)

// remove duplicates by owner id & retain repo with
// highest stargazer count
return Array.from(
sortedData
.reduce((m, obj) => {
const curr = m.get(obj.owner.id)
return m.set(
obj.owner.id,
curr
? curr.stargazerCount < obj.stargazerCount
? obj
: curr
: obj
)
}, new Map())
.values()
).slice(0, 10)
}
},
type(state) {
return state.type
Expand Down

0 comments on commit 79d41fd

Please sign in to comment.