liquidvotingio / liquidvotingio/api

Get weights of direct & indirect delegations

Open
#252 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Elixir
Stars
17
Forks
3
PR merge metrics
No merged PRs in 30d

Description

We wish to show a user (of Decidim, in [#56](https://github.com/liquidvotingio/decidim-module-liquidvoting/issues/56)) the user's voting weight, which may increase (from a base of 1) due to delegations 'received'.

We also wish to show the user how much of this voting weight is due to direct delegations (delegations where the user has been chosen as a delegate), and how much is due to indirect delegations (voting weight delegated to someone earlier in a delegation chains that have been passed on to the user though subsequent delegation(s)).

Thus, we need absinthe queries / a query that will return these values for a given user.

This will also involve developing separate core functions to perform the needed db queries & calculations. Note that currently, `update_vote_weight(vote)` in `lib/liquid_voting/voting_weight.ex` does not differentiate between direct and indirect delegations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/liquid_voting/voting_weight.ex and update_vote_weight(vote), then review the delegation data and the Absinthe query entry points. Define core database queries and calculations that separate direct from indirect delegation weight, and expose the total, direct, and indirect values for a user. Done means the values support the user-facing need described in #56.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, graphql
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.