Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/leaderboard #46

Closed
wants to merge 3 commits into from
Closed

Conversation

Keyrxng
Copy link
Member

@Keyrxng Keyrxng commented Apr 24, 2024

Resolves #45

  • A basic ass leaderboard
  • shows earnings to date
  • shows date they joined (according to supabase)
  • shows meta-info panel

QA

leaderboard.mp4

@Keyrxng Keyrxng requested a review from pavlovcik as a code owner April 24, 2024 13:03
@Keyrxng
Copy link
Member Author

Keyrxng commented Apr 24, 2024

I was going to suggest a UI feature of sorts incorporating the output as an input:username > unspent permits w/ url sort of thing but no probs was my pleasure

Please feel free to make a proposal under the appropriate repository.

@0x4007 remember this from when I authored the CLI? Is this still something that you'd be interested in seeing? It would work much like this PR, pull CSV/JSON from up-to-date source and allow a simple address aggregation search?

I saw it in TG but not sure if it happened, but a script to populate the current permitDB with all previous permits using the cli and then the source could just be supabase for individual users searching for their own unspent permits


I've been using the CLI personally to grab my unspent permits after leaving gathering a couple up if I can 🤣

@ubiquity-os-deployer
Copy link

ubiquity-os-deployer bot commented Apr 24, 2024

@Keyrxng
Copy link
Member Author

Keyrxng commented Apr 24, 2024

two things:

The preview deployment login is redirecting to the live deployment meaning you can't effectively sign in via github into the preview url and the leaderboard uses GH api to grab the source CSV and Supabase for (all) usernames, date created etc unless cached, so that's a trouble.

Seems there's a DB schema mismatch looking at the logs.

What is the users and wallets table supposed to look like at the moment, or where can I find the most update to date db stuff? I used queries from old ubiquibot repo I'm sure, old saved queries anyway

@Keyrxng
Copy link
Member Author

Keyrxng commented Apr 24, 2024

wallets = id | address | created | updated
users = id | wallet_id

where wallet_id is just an auto-incrementing ID and user.id is their GH id right?

@Keyrxng
Copy link
Member Author

Keyrxng commented Apr 24, 2024

Pulling from DB successfully now but I expect that the GitHub auth on the preview deployment still will not log you in which you'd need to be otherwise you get rate limited

image

@0x4007
Copy link
Member

0x4007 commented Apr 25, 2024

This should be on a separate page. It clutters the UI for searching for new work.

Also the numbers don't look right. I'm pretty sure the core team members collected more that what is shown on your screenshot.

Otherwise pretty interesting feature!

@Keyrxng
Copy link
Member Author

Keyrxng commented Apr 25, 2024

This should be on a separate page. It clutters the UI for searching for new work.

So leaderboard button should push to a new page completely i.e /leaderboard and not just remove and replace the bounties? On page load the leaderboard is not shown until clicked and it's a psuedo-nav by just removing the taskContainer and filling it with leaderboard entries.

Should the leaderboard button be up-top or should it join the "help" button down-low?

Also the numbers don't look right.

I was thinking how can I be sitting up there with the big boys myself lmao, but the CLI is only parsing permits from comments posted by either yourself or the bot, not manual payments. I'll need to check if it's checking the new Ubiquibot org for permits too

@rndquu
Copy link
Member

rndquu commented May 14, 2024

@Keyrxng What supabase instance did you use for testing?

I'm getting an empty leadeerboard without any errors when I'm trying the following credentials which are used for the pavlovcik's supabase instance which is currently used for production (@gentlementlegen pls correct me if I'm wrong):

SUPABASE_URL=https://wfzpewmlyiozupulbuur.supabase.co
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs

@Keyrxng
Copy link
Member Author

Keyrxng commented May 14, 2024

That's the one I used.

I'll add a loader/toaster. You need to be signed in with GitHub, open the leaderboard and wait and it will populate. It'll store the info in localStorage so that the next load is instant. I implemented a naïve refresh/update but it'll be better after ubiquity/.github#107 and the subsequent workflow to run every 1-3days? and then we just update the cache if it's beyond whatever the timeframe for the workflow is since the last update.


I'm just after trying it again myself.

image

@rndquu
Copy link
Member

rndquu commented May 14, 2024

I'll add a loader/toaster

Yes, pls add a loader. I cleared the local storage and then everything worked fine.

@Keyrxng
Copy link
Member Author

Keyrxng commented May 14, 2024

Since this depends on the CLI and an update to the workflows, should I aim to clear those up first and then see this through? Because this is currently pulling static leaderboard data from my repo

@rndquu
Copy link
Member

rndquu commented May 15, 2024

@Keyrxng Questions:

  1. This PR reads permits only from supabase, right? I mean this PR doesn't check all_repos_contributors (introduced in Parse multiple orgs for payments .github#107) or anything related.
  2. This PR simply parses multiple orgs and is not really a requirement for the leaderboard to work properly since all permits are read from supabase, right?
  3. This issue implies implementing a workflow that runs on a schedule and updates all_repos_contributors.csv file, right?

@Keyrxng
Copy link
Member Author

Keyrxng commented May 15, 2024

The permits table only has 10 permits in it as far as I can tell, I just pulled and logged to find out. This PR uses Supabase for Wallet > Username tracking.


A better idea might be to open a task and have the payout history that the CLI is able to pull and pipe that into the current Permits table then as you say this PR could simply read from DB for the data instead.

@rndquu
Copy link
Member

rndquu commented May 16, 2024

The permits table only has 10 permits in it as far as I can tell, I just pulled and logged to find out. This PR uses Supabase for Wallet > Username tracking.

A better idea might be to open a task and have the payout history that the CLI is able to pull and pipe that into the current Permits table then as you say this PR could simply read from DB for the data instead.

So the plan is:

  1. Refactor this PR to read permit data only from a DB
  2. Create a new issue for https://github.com/ubiquity/.github/tree/main/airdrop-cli to implement a script that will:
    a) Collect permit data across ubiquity and ubiquibot orgs
    b) Insert this data in the permits table (idempotently)
  3. Close Implement leaderboard workflow .github#108 as not planned since all permits will reside in a DB

Correct?

@Keyrxng
Copy link
Member Author

Keyrxng commented May 16, 2024

Yes this sounds good to me @rndquu

@0x4007
Copy link
Member

0x4007 commented May 16, 2024

Can you instead make a new repo for this? Just fork the code and make a separate page and remove all the complex logic around displaying GitHub issues.

It really doesn't make sense to me to make work.ubq.fi handle leaderboards, but I understand why you did it (the rows are a useful structure to display the leaderboard.)

If you create leaderboard.ubq.fi repo, my cloudflare worker should automatically map it to the domain.

@Keyrxng
Copy link
Member Author

Keyrxng commented May 16, 2024

If you create leaderboard.ubq.fi repo

I assume you mean @rndquu here, once the repo is created if you could ping me and I'll jump on it rndquu

@rndquu
Copy link
Member

rndquu commented May 23, 2024

If you create leaderboard.ubq.fi repo

I assume you mean @rndquu here, once the repo is created if you could ping me and I'll jump on it rndquu

@Keyrxng https://github.com/ubiquity/leaderboard.ubq.fi

@0x4007
Copy link
Member

0x4007 commented Jun 3, 2024

If you create leaderboard.ubq.fi repo

I assume you mean @rndquu here, once the repo is created if you could ping me and I'll jump on it rndquu

@Keyrxng https://github.com/ubiquity/leaderboard.ubq.fi

@Keyrxng if you open a pull there we can test the feature live on the website.

@Keyrxng
Copy link
Member Author

Keyrxng commented Jun 3, 2024

@0x4007 I am due out just shortly for an apt but will open one by this evening.

I had been working on ubiquity/.github#109 trying to ensure the data is as trustworthy and accurate as possible but it's been tricky to know if it's 100% accurate without a lot of manual inspection at first but it's not far off so that's why I haven't made any further progress with this PR.

Data without confirming isNonceClaimed

  "0x4007ce2083c7f3e18097aeb3a39bb8ec149a341d": 19282.950000000008,
  "0x0fc1b909ba9265a846b82cf4ce352fc3e7eeb2ed": 10631.3,
  "0x7e92476d69ff1377a8b45176b1829c4a5566653a": 9030.150000000003,
  "0xae5d1f192013db889b1e2115a370ab133f359765": 7944.9,

Data with confirmed isNonceClaimed

  "0x4007ce2083c7f3e18097aeb3a39bb8ec149a341d": 10515.099999999999,
  "0x0fc1b909ba9265a846b82cf4ce352fc3e7eeb2ed": 9724.999999999998,
  "0x7e92476d69ff1377a8b45176b1829c4a5566653a": 8201.449999999999,
  "0xae5d1f192013db889b1e2115a370ab133f359765": 6873,

@Keyrxng Keyrxng closed this Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contributor leaderboard
3 participants