Giter Site home page Giter Site logo

Comments (13)

isbecker avatar isbecker commented on May 28, 2024 1

Hello I am looking into this issue.

I have made a fork of the repo isbecker/sponsorkit.

opencollective.ts contains the GraphQL query that gets the information from OC API.

I checked the OC API docs and I noticed that the Tier type, has a frequency field.

So I am fairly certain that adding that field into the query that the opencollective.ts file is making (makeQuery), that at least, when the Tier is not a null value, the frequency field will properly show the value of ONETIME in the case when a sponsor was a one-time donor.

I think that the logic in isOneTime is a bit buggy as is right now.

I have made a commit on my fork: isbecker@5191dc7, feel free to take a look ๐Ÿ™‚

Unfortunately, I have not had time to test the changes in the codebase, as I have not done the necessary set up yet. I was looking through the contribution guide and I have not gone through it all yet.

However, I did test the frequency query on the capawesome collective to verify that it does work. There are some oddities, though.

One such issue, the monthlyDollars calculation does not seem straightforward to me yet, based on the OC API docs that I read through.

I will try to take a look at getting things set up to run sponsorkit on my machine so that I can fiddle more.

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024 1

I made a bit of progress on getting things running locally so that I can test and also a bit of progress on getting the correct data for monthlyDollars.

Need to take a break, but I hope to have something ready soon.

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024 1

@isbecker Great progress!

Thanks ๐Ÿ™

These should only be displayed if it is the current month in which the one-time amount was sponsored.

There is a config option config.includePastSponsors which I think should govern this. I will adopt that (the GitHub provider uses it currently).

Also, I would like to be able to filter these out using isOneTime. So isOneTime should just have the correct value. From the screenshot I don't see whether this already works.

I believe that isOneTime is functioning correctly now. I will post an example when I'm back at my computer.


edit

Here's an example of the sponsor info coming out of the opencollective.ts code. I guess this gets further enriched by later steps in the sponsorkit process, because it seems to missing a few things, so please ignore that ๐Ÿ˜‰.

{ 
  "sponsor": {
    "name": "CTS Software",
    "type": "User",
    "login": "guest-2cf739c1",
    "avatarUrl": "https://images.opencollective.com/guest-2cf739c1/avatar/460.png",
    "linkUrl": "https://opencollective.com/guest-2cf739c1"
  },
  "isOneTime": true,
  "monthlyDollars": 5000,
  "privacyLevel": "PUBLIC",
  "tierName": "โšก Custom Plugin"
}

This brings up a point I wanted to ask about. monthlyDollars does not seem relevant for a one-time donation. @antfu what do you think the proper way of representing that should be? Perhaps make a new field in the Sponsorhip interface?

I guess the way that GitHub sponsors works, people are either sponsoring right now or not. I'm not sure, but I suspect the OC API has a lot more info available.

edit Actually, I think the one edge case that monthlyDollars does not cover is a yearly sponsorship. What should the logic be for that case?

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024 1

Since "collective' objects are also "account" objects, I think I can simplify the query somewhat by only querying accounts.

Anyway, I made some changes to the querying and here is the result. Notably, https://opencollective.com/capawesome/contributions/625520 shows up (and won't have a transaction for this order until the 16th).
image

I think this one is correct. I need to check some other collectives and make sure the use-case brought up in #32 still works

from sponsorkit.

antfu avatar antfu commented on May 28, 2024

I don't use OC myself. It would be great if you can directly look into it and send PRs. Thanks!

from sponsorkit.

robingenz avatar robingenz commented on May 28, 2024

All right, I'll have a look at it.

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024

@robingenz here is a PNG generated with my locally modified code. This contains just the OC sponsors.
image

I seem to have some issue with the GitHub sponsors not correctly getting the tier/monthly amount, probably due to the way I have my GH token set up or something else that I have misconfigured; I don't think the GH sponsors are important to show this progress anyway.

Please let me know how it looks ๐Ÿ™‚. I have more work to do to clean things up, but hopefully I am on the right track here.

from sponsorkit.

robingenz avatar robingenz commented on May 28, 2024

@isbecker Great progress!

I seem to have some issue with the GitHub sponsors not correctly getting the tier/monthly amount, probably due to the way I have my GH token set up or something else that I have misconfigured; I don't think the GH sponsors are important to show this progress anyway.

Yeah, that's fine. The GH sponsors integration is working without problems.

Please let me know how it looks ๐Ÿ™‚. I have more work to do to clean things up, but hopefully I am on the right track here.

This looks really good so far. The only thing I notice is that sponsors are also listed who have only sponsored once (e. g. https://opencollective.com/capawesome/contributions/660052) in the past. These should only be displayed if it is the current month in which the one-time amount was sponsored. For example, a sponsor who sponsored once a year ago should not still be shown. But I'm not sure how hard it is to implement this.
Also, I would like to be able to filter these out using isOneTime. So isOneTime should just have the correct value. From the screenshot I don't see whether this already works.

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024

Here is what the list of sponsors for capawesome collective looks like, if we just query for the current month. I guess this is in the same spirit as the way that GitHub sponsors works, because that is by default only the current sponsors.

[
  {
    "sponsor": {
      "name": "AppScreens",
      "type": "User",
      "login": "appscreens",
      "avatarUrl": "https://images.opencollective.com/appscreens/62776aa/avatar/460.png",
      "websiteUrl": "https://appscreens.com/",
      "linkUrl": "https://opencollective.com/appscreens"
    },
    "isOneTime": false,
    "monthlyDollars": 300,
    "privacyLevel": "PUBLIC",
    "createdAt": "2023-12-02T13:04:49.224Z"
  },
  {
    "sponsor": {
      "name": "NFC21",
      "type": "Organization",
      "login": "nfc21",
      "avatarUrl": "https://images.opencollective.com/nfc21/9d1232a/logo/460.png",
      "websiteUrl": "https://nfc21.de",
      "linkUrl": "https://opencollective.com/nfc21"
    },
    "isOneTime": false,
    "monthlyDollars": 50,
    "privacyLevel": "PUBLIC",
    "createdAt": "2023-12-01T17:10:56.410Z"
  },
  {
    "sponsor": {
      "name": "Colorful Casting",
      "type": "Organization",
      "login": "colorful-casting",
      "avatarUrl": "https://images.opencollective.com/colorful-casting/4e2c691/logo/460.png",
      "websiteUrl": "https://colorfulcast.com",
      "linkUrl": "https://opencollective.com/colorful-casting"
    },
    "isOneTime": true,
    "monthlyDollars": 900,
    "privacyLevel": "PUBLIC",
    "createdAt": "2023-12-01T15:18:44.698Z"
  }
]

So for capawesome collective, this is what the current month's sponsor would look like

image

from sponsorkit.

robingenz avatar robingenz commented on May 28, 2024

@isbecker These are the sponsors of the current month but itโ€™s missing the sponsors who sponsor monthly but have not yet sponsored this month (e.g. https://opencollective.com/capawesome/contributions/625520).

from sponsorkit.

isbecker avatar isbecker commented on May 28, 2024

These are the sponsors of the current month but itโ€™s missing the sponsors who sponsor monthly but have not yet sponsored this month

๐Ÿค” you're right.

I think there are multiple queries that need to happen in order to get everything correctly, which is going to make it a little more complex than what I've been attempting.

I am learning some things about GraphQL!

Question

The current code for querying OpenCollective supports 2 modes of operation:

  • collective
  • account (aka "user" or "individual")

I am struggling to understand the use-case that would require this code to work on an "account" basis,
because Open Collective, I think, does not support donating to individuals. Sponsors can only sponsor
a "collective". At least, that seems to be what my research has determined on the matter.

โ“ Is it possible to remove that account-based query functionality and switch to only supporting
queries on collectives?

I think those are the only ones that make any sense for OC anyway.

from sponsorkit.

robingenz avatar robingenz commented on May 28, 2024

I am struggling to understand the use-case that would require this code to work on an "account" basis,
because Open Collective, I think, does not support donating to individuals. Sponsors can only sponsor
a "collective". At least, that seems to be what my research has determined on the matter.

I was also confused by that. But i found this PR: #32
I'm not sure whether this issue affects accounts at all or only collectives. In any case, my issue only refers to collectives.

from sponsorkit.

robingenz avatar robingenz commented on May 28, 2024

I think this one is correct.

Yes, it looks like you've made it! I am looking forward to your PR.

from sponsorkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.