encointer / accounting-frontend

frontend for historical events on Encointer Network. statstics and monthly statements
https://accounting.encointer.org
0 stars 0 forks source link

unique accounts with at least one cycle attendance #14

Closed brenzi closed 5 months ago

brenzi commented 5 months ago

For community A I'd like to know the total number of unique accounts which have received a reward at least once during the entire existence of the community

It would be nice to plot this as a monotonically increasing graph over time (cycle index)

I tried to do this query

query Query {
  issueds(
    filter: { arg0: { equalTo: "u0qj944rhWE" } }
    orderBy: TIMESTAMP_DESC
  ) {
    nodes {
      id
      blockHeight
      timestamp
      arg0
      arg1
      arg2
    }
  }
}

but I can't easily collect all entries because of pagination :-(

pifragile commented 5 months ago

@brenzi a first step would be to use distinct.

query Query {
  issueds(
    filter: { arg0: { equalTo: "u0qj944rhWE" } }
    orderBy: TIMESTAMP_DESC,
    distinct: [ARG1]
  ) {
    nodes {
      id
      blockHeight
      timestamp
      arg0
      arg1
      arg2
    }
  }
}

but the pagination issue remains. you can take my code for pagination if needed here

or else, i could implement it in the accounting backend and also create the chart in the dashboard, if needed.

brenzi commented 5 months ago

as I only need the number for now, I can manually get it by tuning the offset until only few entries remain

query Query {
  issueds(
    offset: 320
    filter: { arg0: { equalTo: "u0qj944rhWE" } }
    orderBy: TIMESTAMP_DESC,
    distinct: [ARG1]
  ) {
    nodes {
      id
      blockHeight
      timestamp
      arg0
      arg1
      arg2
    }
  }
}