added first draft of vote treatment structure

This commit is contained in:
Vicky 2024-11-04 12:36:05 +01:00
parent 530f8e6736
commit 1b6563464d
2 changed files with 47 additions and 1 deletions

View File

@ -34,7 +34,7 @@ type Context<'a> = poise::Context<'a, Data, GenericError>;
#[derive(Debug, poise::Modal)]
#[allow(dead_code)] // fields only used for Debug print
#[name = "Créer un nouveau Vote"]
struct VoteCreation {
pub(crate) struct VoteCreation {
/// The description of the event
#[paragraph]
#[name = "Description"]

View File

@ -5,7 +5,53 @@
//! Many handler functions
//! Every module encompassing a feature
use crate::io::VoteCreation;
#[cfg(test)]
mod tests {
// use super::*;
}
fn treatment_vote_modal(
ctx: poise::ApplicationContext<'_, Data, GenericError>,
data: VoteCreation,
) {
// parse data
// -> group needs to be matched with existing group or return an error
// -> check which of short_name and hours exist and decide on formatting
// create the final product and send to scheduler for next voting window
unimplemented!()
}
fn treatment_vote_command(
ctx: poise::ApplicationContext<'_, Data, GenericError>,
data: VoteCreation,
) {
// parse data
// -> check which of short_name and hours exist and decide on formatting
// create the final product and send to scheduler with the start_date and non_days if specified
unimplemented!()
}
fn treatment_short_vote(
ctx: poise::ApplicationContext<'_, Data, GenericError>,
data: VoteCreation,
) {
// parse data
// -> check whether hours exist and decide on formatting
// create the final product and send to scheduler with the start_date if specified and days
unimplemented!()
}
fn treatment_long_vote(ctx: poise::ApplicationContext<'_, Data, GenericError>, data: VoteCreation) {
// parse data
// create the final product and pass it along with the start_date if it's here and the begining and end dates
unimplemented!()
}
// 1: user types command (vote_modal)
// 2: modal pops
// 3: data from the modal gets parsed
// 3.1 : group has to be matched with groups else error
// 3.2 : check whether or not there are hours and short names, and decide on the formatting depending on it
// 4: send final output to scheduler, with (if possible) context so it can reply instead of sending a new post