imfunniee / gitfolio

:octocat: personal website + blog for every github user

Home Page:https://imfunniee.github.io/gitfolio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'Work' not sorted, repo with 1 stars gets on top

surajmandalcell opened this issue · comments

Shouldn't 'Work' be sorted by number of stars to show best work first?

Idk for now, but i did a merge request. It will add filtering by date, name, stars and forks.

commented

ye it filters by date for now not stars

I don't believe there is a way in the github API to sort by stars without doing it by hand.

https://developer.github.com/v3/repos/#list-user-repositories

commented

you need to push all the repos data to an array and then sort the array according to stars

in populate.js file

function sortStart(a,b){  
  return b.stargazers_count-a.stargazers_count
}

module.exports.updateHTML = (username) => {
//add data to assets/index.html
jsdom.fromFile("./assets/index.html", options).then(function (dom) {
    let window = dom.window, document = window.document;
    (async () => {
        try {
            console.log("Building HTML/CSS...");
            var repos = await got(`https://api.github.com/users/${username}/repos?sort=created`);
            repos = JSON.parse(repos.body);
            repos.sort(sortStart);
commented

@Chargnn is already working on it

commented

you can now sort repos according to stars

node build --name username --sort star --order desc