pub struct Poll {Show 17 fields
pub id: Uuid,
pub building_id: Uuid,
pub created_by: Uuid,
pub title: String,
pub description: Option<String>,
pub poll_type: PollType,
pub options: Vec<PollOption>,
pub is_anonymous: bool,
pub allow_multiple_votes: bool,
pub require_all_owners: bool,
pub starts_at: DateTime<Utc>,
pub ends_at: DateTime<Utc>,
pub status: PollStatus,
pub total_eligible_voters: i32,
pub total_votes_cast: i32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Poll - Sondage pour décisions du conseil de copropriété
Permet au conseil de consulter rapidement les résidents sur des décisions:
- Choix entrepreneur (avec devis attachés)
- Couleur de peinture
- Horaires de travaux
- Décisions mineures entre AG
Fields§
§id: Uuid§building_id: Uuid§created_by: Uuid§title: String§description: Option<String>§poll_type: PollType§options: Vec<PollOption>§is_anonymous: bool§allow_multiple_votes: bool§require_all_owners: bool§starts_at: DateTime<Utc>§ends_at: DateTime<Utc>§status: PollStatus§total_eligible_voters: i32§total_votes_cast: i32§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Poll
impl Poll
pub fn new( building_id: Uuid, created_by: Uuid, title: String, description: Option<String>, poll_type: PollType, options: Vec<PollOption>, is_anonymous: bool, ends_at: DateTime<Utc>, total_eligible_voters: i32, ) -> Result<Self, String>
Sourcepub fn participation_rate(&self) -> f64
pub fn participation_rate(&self) -> f64
Calculate participation rate
Sourcepub fn get_winning_option(&self) -> Option<&PollOption>
pub fn get_winning_option(&self) -> Option<&PollOption>
Get winning option (for closed polls)
Sourcepub fn record_vote(&mut self, option_id: Uuid) -> Result<(), String>
pub fn record_vote(&mut self, option_id: Uuid) -> Result<(), String>
Update vote count for an option
Sourcepub fn auto_close_if_ended(&mut self) -> bool
pub fn auto_close_if_ended(&mut self) -> bool
Auto-close if past end date
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Poll
impl<'de> Deserialize<'de> for Poll
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<Poll> for PollResponseDto
impl From<Poll> for PollResponseDto
impl StructuralPartialEq for Poll
Auto Trait Implementations§
impl Freeze for Poll
impl RefUnwindSafe for Poll
impl Send for Poll
impl Sync for Poll
impl Unpin for Poll
impl UnwindSafe for Poll
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.