pub struct Resolution {Show 15 fields
pub id: Uuid,
pub meeting_id: Uuid,
pub title: String,
pub description: String,
pub resolution_type: ResolutionType,
pub majority_required: MajorityType,
pub vote_count_pour: i32,
pub vote_count_contre: i32,
pub vote_count_abstention: i32,
pub total_voting_power_pour: f64,
pub total_voting_power_contre: f64,
pub total_voting_power_abstention: f64,
pub status: ResolutionStatus,
pub created_at: DateTime<Utc>,
pub voted_at: Option<DateTime<Utc>>,
}Expand description
Résolution soumise au vote lors d’une assemblée générale
Fields§
§id: Uuid§meeting_id: Uuid§title: String§description: String§resolution_type: ResolutionType§majority_required: MajorityType§vote_count_pour: i32§vote_count_contre: i32§vote_count_abstention: i32§total_voting_power_pour: f64§total_voting_power_contre: f64§total_voting_power_abstention: f64§status: ResolutionStatus§created_at: DateTime<Utc>§voted_at: Option<DateTime<Utc>>Implementations§
Source§impl Resolution
impl Resolution
Sourcepub fn new(
meeting_id: Uuid,
title: String,
description: String,
resolution_type: ResolutionType,
majority_required: MajorityType,
) -> Result<Self, String>
pub fn new( meeting_id: Uuid, title: String, description: String, resolution_type: ResolutionType, majority_required: MajorityType, ) -> Result<Self, String>
Crée une nouvelle résolution
Sourcepub fn record_vote_pour(&mut self, voting_power: f64)
pub fn record_vote_pour(&mut self, voting_power: f64)
Enregistre un vote “Pour” et met à jour les compteurs
Sourcepub fn record_vote_contre(&mut self, voting_power: f64)
pub fn record_vote_contre(&mut self, voting_power: f64)
Enregistre un vote “Contre” et met à jour les compteurs
Sourcepub fn record_abstention(&mut self, voting_power: f64)
pub fn record_abstention(&mut self, voting_power: f64)
Enregistre une abstention et met à jour les compteurs
Sourcepub fn calculate_result(&self, total_voting_power: f64) -> ResolutionStatus
pub fn calculate_result(&self, total_voting_power: f64) -> ResolutionStatus
Calcule le résultat du vote en fonction du type de majorité
Sourcepub fn close_voting(&mut self, total_voting_power: f64) -> Result<(), String>
pub fn close_voting(&mut self, total_voting_power: f64) -> Result<(), String>
Clôture le vote et finalise le statut
Sourcepub fn total_votes(&self) -> i32
pub fn total_votes(&self) -> i32
Retourne le nombre total de votes exprimés
Sourcepub fn pour_percentage(&self) -> f64
pub fn pour_percentage(&self) -> f64
Retourne le pourcentage de votes “Pour”
Sourcepub fn contre_percentage(&self) -> f64
pub fn contre_percentage(&self) -> f64
Retourne le pourcentage de votes “Contre”
Sourcepub fn abstention_percentage(&self) -> f64
pub fn abstention_percentage(&self) -> f64
Retourne le pourcentage d’abstentions
Trait Implementations§
Source§impl Clone for Resolution
impl Clone for Resolution
Source§fn clone(&self) -> Resolution
fn clone(&self) -> Resolution
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Resolution
impl Debug for Resolution
Source§impl<'de> Deserialize<'de> for Resolution
impl<'de> Deserialize<'de> for Resolution
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Resolution> for ResolutionResponse
impl From<Resolution> for ResolutionResponse
Source§fn from(resolution: Resolution) -> Self
fn from(resolution: Resolution) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Resolution
impl PartialEq for Resolution
Source§impl Serialize for Resolution
impl Serialize for Resolution
impl StructuralPartialEq for Resolution
Auto Trait Implementations§
impl Freeze for Resolution
impl RefUnwindSafe for Resolution
impl Send for Resolution
impl Sync for Resolution
impl Unpin for Resolution
impl UnwindSafe for Resolution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.