socialappslab / appcivist-platform

Core AppCivist Platform
http://citris-uc.org/social-apps-lab/project/appcivist-2/
Other
5 stars 0 forks source link

Add support for active and archived ballots in campaign #362

Closed cdparra closed 7 years ago

cdparra commented 7 years ago

Add endpoints to create new Ballots in a campaign, archived currently active ballots and list active/archived ballots. As examples, see the Working Group create/archive ballot endpoints:

POST /api/assembly/:aid/group/:gid/ballot controllers.WorkingGroups.nextBallotForWorkingGroup(aid: Long, gid: Long) PUT /api/assembly/:aid/group/:gid/ballot controllers.WorkingGroups.archiveWorkingGroupsBallot(aid: Long, gid: Long)

To make this possible, let's create the following endpoints (which will make it possible to create ballots not only on campaigns, but on other entities two:

javierpf commented 7 years ago

I found this in the current implementation for creating new ballots for a working group. Should this implementation remain in the cases where the resource space belongs to a working group? if (workingGroup.getBlockMajority()) { ballotConfig.setValue("YES/NO/ABSTAIN/BLOCK"); ballotConfig.save(); ballotConfig = new BallotConfiguration(); ballotConfig.setBallotId(consensusBallot.getId()); ballotConfig .setKey(GlobalData.CONFIG_COMPONENT_VOTING_SYSTEM_PLURALITY_BLOCK_THRESHOLD); ballotConfig .setValue(workingGroup.getMajorityThreshold() != null ? workingGroup .getMajorityThreshold() : "SIMPLE"); ballotConfig.save(); } else { ballotConfig.setValue("YES/NO/ABSTAIN"); ballotConfig.save(); }

javierpf commented 7 years ago

In the current implementation of the endpoint "PUT /api/assembly/:aid/group/:gid/ballot" only archives the ballot. Should we maintain this behavior, or should allow updating the ballot?

cdparra commented 7 years ago

About (1), we should read the list of configurations for the ballot from the request. The request should include a "configs" array with one config for the type of voting system, and other configs for the configurations related to that voting system. See the config options for the component of voting in the default campaign json for the available configs.

About the PUT, we should also UPDATE the ballot (not only archive)