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

[FEATURE] Randomize the order of the issues #400

Open
adityaraute opened this issue Dec 28, 2023 · 7 comments
Open

[FEATURE] Randomize the order of the issues #400

adityaraute opened this issue Dec 28, 2023 · 7 comments

Comments

@adityaraute
Copy link
Member

adityaraute commented Dec 28, 2023

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
Copy link
Member

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
Copy link
Member Author

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

@Bashamega
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

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

No branches or pull requests

3 participants