Skip to content

Commit

Permalink
Merge pull request #78 from lblod/feature/unanimous-voting
Browse files Browse the repository at this point in the history
Feature/unanimous voting
  • Loading branch information
nvdk committed Nov 8, 2021
2 parents fb4ee94 + a2b5d31 commit 3265808
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 42 deletions.
4 changes: 3 additions & 1 deletion models/vote.js
Expand Up @@ -44,6 +44,7 @@ export default class Vote {
subject: subject.value,
result: result.value,
isSecret: isSecret.value === "true",
isUnanimous: (Number(positiveVotes.value) === 0 || Number(negativeVotes.value) === 0) && Number(abstentionVotes.value) === 0,
positiveVotes: positiveVotes.value,
negativeVotes: negativeVotes.value,
abstentionVotes: abstentionVotes.value,
Expand All @@ -52,11 +53,12 @@ export default class Vote {
});
}

constructor({uri, subject, result, isSecret, positiveVotes, negativeVotes, abstentionVotes, position, adminBodyClassification}) {
constructor({uri, subject, result, isSecret, isUnanimous, positiveVotes, negativeVotes, abstentionVotes, position, adminBodyClassification}) {
this.uri = uri;
this.subject = subject;
this.result = result;
this.isSecret = isSecret;
this.isUnanimous = isUnanimous;
this.positiveVotes = positiveVotes;
this.negativeVotes = negativeVotes;
this.abstentionVotes = abstentionVotes;
Expand Down
59 changes: 39 additions & 20 deletions support/templates/partials/mandatee-list.hbs
@@ -1,29 +1,48 @@
{{#if mandatees}}
{{#if mandatees.length}}
<div class="au-c-template-list-container">
<p>
<strong>{{title}}</strong>
</p>
<ul class="au-c-template-list-inline">
{{#each mandatees}}
<li class="au-c-template-list-inline__item" typeof="http://data.vlaanderen.be/ns/mandaat#Mandataris" resource="{{this.uri}}" property="{{../property}}">
<span resource="{{this.personUri}}" property="mandaat:isBestuurlijkeAliasVan" typeof="person:Person">
<span property="persoon:gebruikteVoornaam">{{this.name}}</span>
<span property="foaf:familyName">{{this.familyName}} </span>
</span>
{{#if ../includeRole}}
(
{{#if hideText}}
{{#each mandatees}}
<div typeof="http://data.vlaanderen.be/ns/mandaat#Mandataris" resource="{{this.uri}}" property="{{../property}}">
<span resource="{{this.personUri}}" property="mandaat:isBestuurlijkeAliasVan" typeof="person:Person">
<span property="persoon:gebruikteVoornaam" content={{this.name}}></span>
<span property="foaf:familyName" content={{this.familyName}}></span>
</span>
{{#if ../includeRole}}
(
<span property="org:holds" typeof="mandaat:Mandaat" resource="{{this.positionUri}}">
<span property="org:role" typeof="skos:Concept" resource="{{this.roleUri}}">
<span property="skos:prefLabel">{{this.role}}</span>
<span property="skos:prefLabel" content={{this.role}}></span>
</span>
</span>
</span>
)
{{/if}}
</li>
{{/each}}
</ul>
</div>
{{/if}}
</div>
{{/each}}
{{else}}
<div class="au-c-template-list-container">
<p>
<strong>{{title}}</strong>
</p>
<ul class="au-c-template-list-inline">
{{#each mandatees}}
<li class="au-c-template-list-inline__item" typeof="http://data.vlaanderen.be/ns/mandaat#Mandataris" resource="{{this.uri}}" property="{{../property}}">
<span resource="{{this.personUri}}" property="mandaat:isBestuurlijkeAliasVan" typeof="person:Person">
<span property="persoon:gebruikteVoornaam" content={{this.name}}>{{this.name}}</span>
<span property="foaf:familyName" content={{this.familyName}}>{{this.familyName}} </span>
</span>
{{#if ../includeRole}}
(
<span property="org:holds" typeof="mandaat:Mandaat" resource="{{this.positionUri}}">
<span property="org:role" typeof="skos:Concept" resource="{{this.roleUri}}">
<span property="skos:prefLabel" content={{this.role}}>{{this.role}}</span>
</span>
</span>
)
{{/if}}
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{/if}}
{{/if}}
53 changes: 32 additions & 21 deletions support/templates/partials/treatment.hbs
Expand Up @@ -56,27 +56,38 @@
<p lang="nl-BE" property="besluit:onderwerp">{{this.subject}}</p>
{{> mandateeList mandatees=this.attendees property="besluit:heeftAanwezige" title="Aanwezigen tijdens de stemming" includeRole=false}}
{{> mandateeList mandatees=this.voters property="besluit:heeftStemmer" title="Effectieve stemmers" includeRole=false}}
<p>
Totaal aantal voorstanders:
<span datatype="xsd:integer" property="besluit:aantalVoorstanders" content="{{this.positiveVotes}}">{{this.positiveVotes}}</span>
</p>
<p>
Totaal aantal tegenstanders:
<span datatype="xsd:integer" property="besluit:aantalTegenstanders" content="{{this.negativeVotes}}">{{this.negativeVotes}}</span>
</p>
<p>
Totaal aantal onthoudingen, blanco of ongeldig:
<span datatype="xsd:integer" property="besluit:aantalOnthouders" content="{{this.abstentionVotes}}">{{this.abstentionVotes}}</span>
</p>
{{#unless this.geheim}}
{{> mandateeList mandatees=this.positiveVoters property="besluit:heeftVoorstander" title="Voorstanders" includeRole=false}}
{{> mandateeList mandatees=this.negativeVoters property="besluit:heeftTegenstander" title="Tegenstanders" includeRole=false}}
{{> mandateeList mandatees=this.abstentionVoters property="besluit:heeftOnthouders" title="Onthoudingen, blanco of ongeldig" includeRole=false}}
{{/unless}}
<p>
Met als gevolg,
</p>
<p lang="nl-BE" property="besluit:gevolg">{{this.result}}</p>
{{#if this.isUnanimous}}
<span datatype="xsd:integer" property="besluit:aantalVoorstanders" content="{{this.positiveVotes}}"></span>
<span datatype="xsd:integer" property="besluit:aantalTegenstanders" content="{{this.negativeVotes}}"></span>
<span datatype="xsd:integer" property="besluit:aantalOnthouders" content="{{this.abstentionVotes}}"></span>
{{#unless this.geheim}}
{{> mandateeList mandatees=this.positiveVoters property="besluit:heeftVoorstander" title="Voorstanders" includeRole=false hideText=true}}
{{> mandateeList mandatees=this.negativeVoters property="besluit:heeftTegenstander" title="Tegenstanders" includeRole=false hideText=true}}
{{> mandateeList mandatees=this.abstentionVoters property="besluit:heeftOnthouders" title="Onthoudingen, blanco of ongeldig" includeRole=false hideText=true}}
{{/unless}}
<p><span lang="nl-BE" property="besluit:gevolg">{{this.result}}</span>, met eenparigheid van stemmen</p>
{{else}}
<p>
Totaal aantal voorstanders:
<span datatype="xsd:integer" property="besluit:aantalVoorstanders" content="{{this.positiveVotes}}">{{this.positiveVotes}}</span>
</p>
<p>
Totaal aantal tegenstanders:
<span datatype="xsd:integer" property="besluit:aantalTegenstanders" content="{{this.negativeVotes}}">{{this.negativeVotes}}</span>
</p>
<p>
Totaal aantal onthoudingen, blanco of ongeldig:
<span datatype="xsd:integer" property="besluit:aantalOnthouders" content="{{this.abstentionVotes}}">{{this.abstentionVotes}}</span>
</p>
{{#unless this.geheim}}
{{> mandateeList mandatees=this.positiveVoters property="besluit:heeftVoorstander" title="Voorstanders" includeRole=false}}
{{> mandateeList mandatees=this.negativeVoters property="besluit:heeftTegenstander" title="Tegenstanders" includeRole=false}}
{{> mandateeList mandatees=this.abstentionVoters property="besluit:heeftOnthouders" title="Onthoudingen, blanco of ongeldig" includeRole=false}}
{{/unless}}
<p>Met als gevolg,</p>
<p lang="nl-BE" property="besluit:gevolg">{{this.result}}</p>
{{/if}}

</div>
{{/each}}
</div>
Expand Down

0 comments on commit 3265808

Please sign in to comment.