Skip to content

flaviu-vanca/Sell-And-Win-Raffle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Sell & Win Raffle ๐ŸŽŸ๏ธ

Java JavaFX Build Tests

Desktop raffle ticket management system built with JavaFX. Designed for local raffle campaigns with an operator-friendly workflow for managing items, selling tickets, tracking players, and running a live draw.


๐Ÿงพ About

Sell & Win Raffle is a local-first desktop application for organizing and running raffle campaigns end-to-end:

  • Manage raffle items (prizes)
  • Sell tickets and assign ticket IDs automatically
  • Track players and ticket inventory
  • Run a live draw and announce winners

Data is stored locally using CSV files and item-specific image folders under the userโ€™s home directory, keeping setup simple and backups straightforward.


โœจ Key Features

  • ๐Ÿท๏ธ Create raffle items with title, description, ticket count, and ticket price
  • ๐Ÿ–ผ๏ธ Store and browse item images (with a configurable default image)
  • ๐Ÿ‘ค Sell tickets to players and auto-assign ticket IDs
  • โ™ป๏ธ Reuse ticket IDs when player records are removed
  • ๐Ÿ“ฆ Track remaining ticket inventory per item
  • ๐Ÿ”Ž Search player status by name, phone number, or ticket ID
  • ๐ŸŽฒ Run a live draw and show the winner (or indicate when a selected ticket was not sold)
  • ๐Ÿงฐ Package as a JAR and a Windows .exe (Launch4j)

๐Ÿงฑ Tech Stack

Area Details
๐Ÿ’ป Language Java 21
๐Ÿงฉ UI JavaFX 21, FXML, CSS
๐Ÿ—๏ธ Build Maven
โœ… Testing JUnit 5
๐Ÿ’พ Storage Local CSV files
๐Ÿ“ฆ Packaging JavaFX Maven Plugin, Launch4j artifacts in out/artifacts/

๐Ÿ”„ Application Flow

1) Add a raffle item

Create a new item with:

  • Title
  • Description
  • Number of tickets
  • Ticket price

When an item is created, the app prepares:

  • A folder for the itemโ€™s images
  • A ticket record CSV for that item
  • An entry in the main data.csv catalog

2) Add item images

Each item gets its own image folder under the application data directory. Operators can set a default image for the main dashboard and browse all images for an item in the item viewer.

3) Sell tickets

For a selected item, the operator can add players by entering:

  • Player name
  • Phone number
  • Number of tickets to purchase

The app randomly assigns available ticket IDs and writes the updated player state back to the itemโ€™s record file.

4) Check player status

The player status screen supports searching by:

  • Ticket ID
  • Phone number
  • Player name

5) Run the draw

The draw screen animates ticket number generation and stops on the selected ticket:

  • If the ticket belongs to a player, the winner is displayed.
  • If the ticket has not been sold, the UI clearly indicates that outcome.

๐Ÿ—‚๏ธ Data Storage

At runtime, the application writes data to the userโ€™s home directory:

~/Sell & Win Raffle/
  data/
    data.csv
  records/
    <item-title>.csv
  <item-title>/
    image files...

data/data.csv

Stores the master item catalog with:

  • Image path
  • Title
  • Description
  • Available tickets
  • Ticket price

records/<item-title>.csv

Stores the ticket ledger for a single raffle item with:

  • Ticket ID
  • Player name
  • Phone number
  • Number of tickets associated with that buyer

๐Ÿ“ Project Structure

src/
  main/
    java/
      raffle/
        controllers/
        main/
        models/
        utils/
    resources/
      fxml_files/
      icons/
      stylesheets/
  test/
    raffle/
      controllers/
      main/
      models/
      utils/

๐Ÿ—๏ธ Architecture

Main application layer

  • raffle.main.App โ€” loads the JavaFX application, shows the loading screen, and navigates between views
  • raffle.main.EntryPoint โ€” thin entry point class used to launch the app

Controllers

The UI is split into focused JavaFX controllers:

  • MainViewController
  • AddItemController
  • AddPlayerController
  • DrawController
  • ViewItemController
  • PlayerStatusController
  • LoadingController

Domain models

  • Item
  • Player

Persistence utilities

  • ItemDataReaderAndWriter
  • PlayerDataReaderAndWriter

These utility classes handle CSV parsing and serialization.


โœ… Validation and Safety

Operator-facing safeguards include:

  • Empty-field validation on item and player forms
  • Positive-number validation for ticket counts and ticket price
  • Basic phone number validation
  • File accessibility checks before writing CSV files
  • Confirmation dialogs before deleting items or player records

๐Ÿ“‹ Requirements

  • Java 21
  • Maven 3.9+
  • Windows is the primary packaged target for the included .exe artifact

๐Ÿš€ Running the Application

Start in development mode

mvn clean javafx:run

Run tests

mvn test

Build the project

mvn clean package

๐Ÿงช Testing

The repository contains automated tests for:

  • Controllers
  • Models
  • CSV reader/writer utilities
  • Main application entry points

Current repository test coverage signals include:

  • 12 test classes
  • 47 JUnit tests

๐Ÿ“ฆ Included Artifacts

The repository includes generated application artifacts in:

out/artifacts/Sell_and_Win_Raffle_jar/

That folder contains:

  • Sell_and_Win_Raffle.jar
  • Sell & Win Raffle.exe

๐Ÿ–ฅ๏ธ Screens in the Application

The JavaFX UI currently includes these views:

  • Loading view
  • Main view
  • Add item view
  • Add player view
  • Draw view
  • View item view
  • Player status view

โš ๏ธ Current Limitations

  • CSV-based persistence (not database-backed)
  • Designed for local use (not multi-user)
  • Images managed through the local file system
  • Draw can stop on a ticket that has not been sold (and the UI reports that explicitly)

๐Ÿ›ฃ๏ธ Future Improvements

  • Replace CSV storage with a relational database for stronger concurrency support
  • Add sales reports and export features
  • Add installer-based distribution for non-technical operators
  • Track draw history and operational audit logs
  • Improve image management and default image workflows

About

Java-based Raffle Ticket Management System allows users to efficiently manage raffle items and player data. The application features a user-friendly interface for adding and viewing raffle items, managing player information, and conducting raffle draws. Data is stored in CSV files, ensuring easy data management and accessibility.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors