Documentation
This commit is contained in:
@@ -28,7 +28,7 @@ struct TicketPartial {
|
||||
/// for calculating and visualizing ticket distribution per room.
|
||||
///
|
||||
/// # Fields
|
||||
/// - `tickets`: A vector of `TicketPartial` containing ticket data relevant for room totals.
|
||||
/// - `tickets`: A vector of [`TicketPartial`] containing ticket data relevant for room totals.
|
||||
#[derive(Properties, PartialEq)]
|
||||
struct RoomTotalsProps {
|
||||
tickets: Vec<TicketPartial>,
|
||||
@@ -64,7 +64,7 @@ fn weekday_index(dt: &DateTime<Utc>) -> usize {
|
||||
/// the total count of tickets submitted on that day.
|
||||
///
|
||||
/// # Arguments
|
||||
/// - `tickets`: A slice of `TicketPartial` items to count.
|
||||
/// - `tickets`: A slice of [`TicketPartial`] items to count.
|
||||
///
|
||||
/// # Returns
|
||||
/// An array `[usize; 7]` with ticket counts for each weekday.
|
||||
@@ -78,12 +78,12 @@ fn count_by_weekday(tickets: &[TicketPartial]) -> [usize; 7] {
|
||||
|
||||
/// Calculates the occurrences of each weekday within the date range covered by the tickets.
|
||||
///
|
||||
/// This function determines the minimum and maximum dates from the provided `TicketPartial`
|
||||
/// This function determines the minimum and maximum dates from the provided [`TicketPartial`]
|
||||
/// slice and then counts how many times each weekday occurs within that inclusive date range.
|
||||
/// This is useful for normalizing ticket counts against the number of available days for each weekday.
|
||||
///
|
||||
/// # Arguments
|
||||
/// - `partials`: A slice of `TicketPartial` items defining the date range.
|
||||
/// - `partials`: A slice of [`TicketPartial`] items defining the date range.
|
||||
///
|
||||
/// # Returns
|
||||
/// An array `[usize; 7]` where each element represents the number of times a
|
||||
@@ -132,7 +132,8 @@ fn day_counts(partials: &[TicketPartial]) -> [usize; 7] {
|
||||
|
||||
/// Converts a numerical room representation back into a human-readable string format.
|
||||
///
|
||||
/// This function is the inverse of the room parsing logic in `SubmitTicket` component.
|
||||
/// This function is the inverse of the room parsing logic in
|
||||
/// [`SubmitTicket`](`crate::pages::ticket::SubmitTicket`) component.
|
||||
/// It converts negative numbers back to "K" prefixed rooms, numbers >= 1000 back to "D" prefixed rooms,
|
||||
/// and other numbers to their string representation.
|
||||
///
|
||||
@@ -303,12 +304,12 @@ pub fn ticket_count_component() -> Html {
|
||||
///
|
||||
/// # State
|
||||
/// Uses `use_state` hooks to manage:
|
||||
/// - `tickets`: A vector of `TicketPartial` for statistical analysis.
|
||||
/// - `tickets`: A vector of [`TicketPartial`] for statistical analysis.
|
||||
/// - `error`: Any error message from API calls.
|
||||
/// - `loading`: A boolean indicating if data is being fetched.
|
||||
///
|
||||
/// # Functionality
|
||||
/// - Fetches all tickets (as `TicketPartial`) from `/api/tickets`.
|
||||
/// - Fetches all tickets (as [`TicketPartial`]) from `/api/tickets`.
|
||||
/// - Calculates:
|
||||
/// - `counts`: Number of tickets submitted on each weekday.
|
||||
/// - `occ`: Number of occurrences of each weekday in the ticket date range.
|
||||
@@ -421,7 +422,7 @@ pub fn submit_stats_component() -> Html {
|
||||
|
||||
/// A component that displays the total number of tickets per room.
|
||||
///
|
||||
/// This component takes a list of `TicketPartial` items and calculates the
|
||||
/// This component takes a list of [`TicketPartial`] items and calculates the
|
||||
/// total number of tickets for each room. It then displays these totals
|
||||
/// in a sorted list with a bar chart visualization.
|
||||
///
|
||||
@@ -433,7 +434,7 @@ pub fn submit_stats_component() -> Html {
|
||||
/// - **Sorts Results**: Displays rooms sorted by ticket count in descending order.
|
||||
/// - **Visualizes Data**: Renders a bar chart where the width of each bar is
|
||||
/// proportional to the ticket count for that room, relative to the room with the maximum tickets.
|
||||
/// - **Room Formatting**: Uses the `parse_room` function to display room numbers
|
||||
/// - **Room Formatting**: Uses the [`parse_room`] function to display room numbers
|
||||
/// in a human-readable format.
|
||||
///
|
||||
/// # Example
|
||||
|
||||
Reference in New Issue
Block a user