Adds some doc

This commit is contained in:
Dandaedre 2024-11-10 05:09:18 +01:00
parent d93df10aa2
commit 3e72207679
2 changed files with 15 additions and 21 deletions

View File

@ -11,9 +11,6 @@ use poise::serenity_prelude;
use thiserror::Error;
use uuid::Uuid;
// // Since the errors themselves are very verbose, this seemed like complete overkill
// #[allow(clippy::missing_docs_in_private_items)]
/// Global error struct for idlefox
///
/// This enum represents various errors that can occur when interacting with most of the section of the program

View File

@ -11,7 +11,6 @@
//! to track and manage the progression of each voting event according to
//! predefined rules and conditions.
#![allow(clippy::missing_docs_in_private_items)]
use std::fmt::Display;
use chrono::NaiveDateTime;
@ -21,9 +20,13 @@ use crate::{date::NaiveDateList, io::VoteContainer, IdleError};
use super::Ballot;
/// A pending event, waiting to be opened. In this state the even can be safely modified
/// and either manual input or the autostart date will start the vote.
#[derive(Serialize, Deserialize, Default)]
#[cfg_attr(test, derive(Clone))]
pub struct EventPending {
/// The parsed representation of the vote associated with this event.
/// It holds the details required for the voting process.
pub(super) parsed_vote: ParsedVote,
}
@ -37,7 +40,10 @@ impl EventPending {
#[derive(Serialize, Deserialize)]
#[cfg_attr(test, derive(Clone))]
// An ongoing event, waiting to be closed thus allowing the ballots to be counted.
pub struct EventOngoing {
/// The parsed representation of the vote associated with this event.
/// It holds the details required for the voting process.
pub(super) parsed_vote: ParsedVote,
}
@ -57,7 +63,15 @@ impl EventOngoing {
#[derive(Serialize, Deserialize)]
#[cfg_attr(test, derive(Clone))]
/// A closed event, while the users cannot interract with it in this state,
/// this event can still be reopened and it's results can be read.
/// All events have an expiry date and in this state the event will be cleaned
/// up after a while.
///
/// Closing an event will call the cleanup and completion functions.
pub struct EventClosed {
/// The parsed representation of the vote associated with this event.
/// It holds the details required for the voting process.
pub(super) parsed_vote: ParsedVote,
}
@ -74,8 +88,6 @@ pub(super) struct ParsedVote {
pub(super) title: String,
/// Description of the event
pub(super) description: String,
// /// The global status of the vote
// pub(super) status: EventStatus,
/// Date at which to autostart the vote process
pub(super) launch_date: NaiveDateTime,
/// Date at which to autoclose the vote process
@ -86,24 +98,9 @@ pub(super) struct ParsedVote {
pub(super) votes: Vec<Ballot>,
/// The list of values to vote for, this list all the valid dates to vote for
pub(super) list_candidates: NaiveDateList,
// / The vote type
}
impl ParsedVote {
// #[allow(dead_code, unused_variables)]
// pub(crate) fn new(
// title: String,
// description: String,
// status: EventStatus,
// launch_date: NaiveDateTime,
// close_date: NaiveDateTime,
// // ballots: Vec<Ballot>,
// list_candidates: NaiveDateList,
// ) -> Self {
// // Have a rather smart close date if not specified
// todo!()
// }
/// All the logic behind a vote becoming live
pub(super) fn launch(&mut self) -> Result<(), IdleError> {
// TODO: Define this