feat: Enahnced the dashboard
This commit is contained in:
parent
b606923102
commit
67b80f237d
@ -112,7 +112,12 @@ impl GovernanceController {
|
|||||||
|
|
||||||
// Get the nearest deadline proposal for the voting pane
|
// Get the nearest deadline proposal for the voting pane
|
||||||
if let Some(nearest_proposal) = sorted_active_proposals.first() {
|
if let Some(nearest_proposal) = sorted_active_proposals.first() {
|
||||||
|
// Calculate voting results for the nearest proposal
|
||||||
|
let results = Self::calculate_voting_results_from_proposal(nearest_proposal);
|
||||||
|
|
||||||
|
// Add both the proposal and its results to the context
|
||||||
ctx.insert("nearest_proposal", nearest_proposal);
|
ctx.insert("nearest_proposal", nearest_proposal);
|
||||||
|
ctx.insert("nearest_proposal_results", &results);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate statistics from the database
|
// Calculate statistics from the database
|
||||||
|
@ -63,16 +63,40 @@
|
|||||||
<p>{{ nearest_proposal.description }}</p>
|
<p>{{ nearest_proposal.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% set yes_percent = 0 %}
|
||||||
|
{% set no_percent = 0 %}
|
||||||
|
{% set abstain_percent = 0 %}
|
||||||
|
{% set total_votes = 0 %}
|
||||||
|
|
||||||
|
{% if nearest_proposal_results is defined %}
|
||||||
|
{% if nearest_proposal_results.total_votes > 0 %}
|
||||||
|
{% set yes_percent = (nearest_proposal_results.yes_count * 100 / nearest_proposal_results.total_votes) |
|
||||||
|
int %}
|
||||||
|
{% set no_percent = (nearest_proposal_results.no_count * 100 / nearest_proposal_results.total_votes) |
|
||||||
|
int %}
|
||||||
|
{% set abstain_percent = (nearest_proposal_results.abstain_count * 100 /
|
||||||
|
nearest_proposal_results.total_votes) |
|
||||||
|
int %}
|
||||||
|
{% endif %}
|
||||||
|
{% set total_votes = nearest_proposal_results.total_votes %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="progress mb-3" style="height: 25px;">
|
<div class="progress mb-3" style="height: 25px;">
|
||||||
<div class="progress-bar bg-success" role="progressbar" style="width: 65%" aria-valuenow="65"
|
<div class="progress-bar bg-success" role="progressbar" style="width: {{ yes_percent }}%"
|
||||||
aria-valuemin="0" aria-valuemax="100">65% Yes</div>
|
aria-valuenow="{{ yes_percent }}" aria-valuemin="0" aria-valuemax="100">{{ yes_percent }}% Yes
|
||||||
<div class="progress-bar bg-danger" role="progressbar" style="width: 35%" aria-valuenow="35"
|
</div>
|
||||||
aria-valuemin="0" aria-valuemax="100">35% No</div>
|
<div class="progress-bar bg-danger" role="progressbar" style="width: {{ no_percent }}%"
|
||||||
|
aria-valuenow="{{ no_percent }}" aria-valuemin="0" aria-valuemax="100">{{ no_percent }}% No
|
||||||
|
</div>
|
||||||
|
<div class="progress-bar bg-secondary" role="progressbar" style="width: {{ abstain_percent }}%"
|
||||||
|
aria-valuenow="{{ abstain_percent }}" aria-valuemin="0" aria-valuemax="100">{{ abstain_percent
|
||||||
|
}}% Abstain
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex justify-content-between text-muted small mb-4">
|
<div class="d-flex justify-content-between text-muted small mb-4">
|
||||||
<span>26 votes cast</span>
|
<span>{{ total_votes }} votes cast</span>
|
||||||
<span>Quorum: 75% reached</span>
|
<span>Quorum: {% if total_votes >= 20 %}75% reached{% else %}Not reached{% endif %}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
|
Loading…
Reference in New Issue
Block a user