Persistent Meeting History

Overview

The Persistent Meeting History module is responsible for storing and retrieving records of past meetings, enabling users to review historical meeting cost data and to clear stored meeting history when desired. This functionality ensures that meeting cost information is preserved beyond the current session, facilitating auditing, analysis, or comparison of meetings over time.

By leveraging browser localStorage via an abstraction layer, this module addresses the problem of transient meeting data loss when the application is closed or refreshed. It allows a seamless user experience where past meetings remain accessible and manageable independently from the live meeting tracking functionality.


Core Concepts and Functionality

Data Persistence and Storage Management

At the heart of the Persistent Meeting History module is the Warehouse class, which abstracts interactions with the browser's localStorage API. This abstraction encapsulates all operations related to saving, loading, and clearing meeting data securely and efficiently.

Key Warehouse methods include:

This design isolates storage concerns from the rest of the application, promoting maintainability and potential future substitution of storage mechanisms.

Historical Meeting Data Display

The module includes a dedicated view function responsible for rendering the stored meeting data into a user-friendly table. This is implemented in the PastMeetingsTemplate view, which dynamically generates an HTML table summarizing all saved meetings.

Key features of the historical display:

This rendering approach ensures that users can easily scan, interpret, and understand their meeting history without manually parsing raw data.

Interaction with Live Meeting Tracking

While Persistent Meeting History primarily focuses on storage and display of past meetings, it closely interacts with the live meeting system through the following workflow:

  1. When a meeting ends (stopped by the user), the current meeting data, including all increments, is saved to localStorage via the Warehouse.

  2. The historical meetings view is refreshed to include the newly saved meeting.

  3. Users can clear meeting history independently of live meeting operations.

  4. The live meeting model remains decoupled from storage mechanics, delegating persistence responsibilities to the Warehouse.

This separation of concerns allows the live meeting tracking (Real-Time Meeting Cost Tracking) to focus solely on active data, while Persistent Meeting History manages archival and retrieval.


Workflow and Module Interaction

The following sequence outlines the key steps in managing persistent meeting history, illustrating the interaction between the UI, Warehouse, Meeting model, and views:

sequenceDiagram
participant User
participant UI
participant MeetingModel
participant Warehouse
participant PastMeetingsView
User->>UI: Clicks "Stop" meeting
UI->>MeetingModel: stopMeeting()
MeetingModel->>Warehouse: save(meeting data)
Warehouse-->>UI: confirmation
UI->>PastMeetingsView: updatePastMeetings()
PastMeetingsView->>Warehouse: load()
Warehouse-->>PastMeetingsView: meeting history data
PastMeetingsView->>UI: render table
User->>UI: clicks "Clear Storage"
UI->>Warehouse: remove()
Warehouse-->>UI: confirmation
UI->>PastMeetingsView: updatePastMeetings() (empty)
PastMeetingsView->>UI: render empty state

This flow ensures that the history is kept current with live meeting events and user controls.


Key File Roles and Relationships

File

Role

lib/models/Warehouse.js

Implements localStorage abstraction for saving, loading, and removing meeting data.

lib/views/pastMeetings.js

Renders the past meetings table UI based on data loaded from Warehouse.

index.js

Coordinates user interactions, wiring meeting lifecycle events with Warehouse persistence and view updates.

Warehouse Usage Example

In index.js, when the user stops a meeting, the meeting data is saved by calling:

meeting.stopMeeting(); // stops timer and finalizes increments
// meeting data is pushed to Warehouse internally or via explicit call
updatePastMeetings(); // triggers past meetings view refresh

The Warehouse encapsulates saving logic as:

save(payload, key=this.defaultKey) {
    let pastMeetings = JSON.parse(this.load()) || [];
    pastMeetings.push(payload);
    if (pastMeetings.length > 10) pastMeetings.shift();
    window.localStorage.setItem(key, JSON.stringify(pastMeetings));
}

Past Meetings Rendering Example

The PastMeetingsTemplate function loads saved meetings and renders them:

let data = warehouse.load();
data = (data !== null) ? JSON.parse(data) : [];

data.map(meetingData => {
    const [lastIncrement] = meetingData.slice().reverse();
    const meeting = new Meeting(lastIncrement.attendeeCount, lastIncrement.averageWage, warehouse, meetingData);
    // Render meeting date, max attendees, total cost, purpose in table row
});

This approach leverages the Meeting model's utility methods such as getMaxAttendees() and getTotalCost() for accurate display.


Subtopics


This detailed explanation presents the Persistent Meeting History module as a vital component for long-term meeting data management, linking live meeting tracking with durable, accessible historical records through structured storage and intuitive display.