EddieHubCommunity / good-first-issue-finder

Issue-Crawler for GitHub based on Sveltekit
https://finder.eddiehub.org
MIT License
528 stars 334 forks source link

[FEATURE] Randomize the order of the issues #400

Open adityaraute opened 10 months ago

adityaraute commented 10 months ago

Description

Currently we are only seeing issues ordered by their date/time of creation. Introducing some randomness here would serve as a great way to ensure all projects get visibility.

Additional information

We could perhaps introduce several criteria for ordering like oldest, newest, most stars on repo, latest activity, most comments, etc.

Cahllagerfeld commented 10 months ago

The idea in general is good, I'm a bit worried that we can implement that, because the data is retrieved from the github api, and paginated, so even when randomizing them it will only be the ones that are returned per page by github

adityaraute commented 10 months ago

What about ordering them on specific criteria? Does the Github API allow for this?

Bashamega commented 10 months ago

Hello:) I would like to work on this issue. I can make like a dropdown and from there you can choose how to sort and these will be the options:

  1. A-Z
  2. Z-A
  3. By Stars
  4. Forks
  5. Updated If you like this idea please assign me
adityaraute commented 10 months ago

I like this if we can implement an ascending and descending order for all criteria. Every contributor may be looking for something different. But again, not sure if this fits with the API

Bashamega commented 10 months ago

I like this if we can implement an ascending and descending order for all criteria. Every contributor may be looking for something different. But again, not sure if this fits with the API

We can use the built sort feature or create our own sorting function. This is the documentation here If you want you can assign me and I will start working on it

Cahllagerfeld commented 10 months ago

I think adding the filter function isn't the same thing as a random order (what this issue is about). The filter will also return a fixed set of issues, and not a random collection of them. Or am I missing something?

Bashamega commented 10 months ago

I think adding the filter function isn't the same thing as a random order (what this issue is about). The filter will also return a fixed set of issues, and not a random collection of them. Or am I missing something?

Your correct, I thought he wanted to order in deferent orders. If he wants to randomize, we can randomize it using svelte. This is an example of how we can randomize it:

function shuffle<T>(array: T[]): T[] {
    let currentIndex = array.length,  randomIndex;

    // While there remain elements to shuffle.
    while (currentIndex != 0) {

      // Pick a remaining element.
      randomIndex = Math.floor(Math.random() * currentIndex);
      currentIndex--;

      // And swap it with the current element.
      [array[currentIndex], array[randomIndex]] = [
        array[randomIndex], array[currentIndex]];
    }

    return array;
};

And then call it somewhere in the api