Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cricket Points Calculator Application

A complete web application for managing and tracking cricket player points with bonus/penalty system.

Features

✅ Player Management - View all players and their current points ✅ Bonus/Penalty System - Add bonus (negative) or penalty (positive) points to players ✅ Transaction History - Track all point additions with descriptions and timestamps ✅ Search Functionality - Search players by name ✅ Export Options:

  • Copy table to clipboard
  • Export to PDF
  • Export to CSV ✅ Database - SQLite database for persistent data storage ✅ Responsive Design - Works on desktop and mobile devices

Installation & Setup

Prerequisites

  • Node.js (v14 or higher)
  • npm (comes with Node.js)

Step 1: Install Dependencies

npm install

This will install:

  • Express.js (web server)
  • SQLite3 (database)
  • CORS (cross-origin requests)
  • Body-parser (JSON parsing)

Step 2: Start the Server

npm start

Or in development mode:

node server.js

You should see:

Cricket Point Calculator Server running on http://localhost:3000
Connected to the SQLite database.

Step 3: Open in Browser

Open your web browser and go to:

http://localhost:3000

How to Use

Adding Points

  1. Select a Player from the dropdown menu
  2. Enter Points:
    • Use negative numbers (-) for bonus points (GOOD)
    • Use positive numbers (+) for penalty points (NOT GOOD)
  3. Select Type: Choose from Bonus, Penalty, Performance Adjustment, or Other
  4. Add Description (Optional): Explain why points are being added
  5. Click "Add Points" button

Viewing Players

  • All players are displayed in a table sorted by points
  • Green badge = Good (negative points)
  • Red badge = Penalty (positive points)
  • Use the search box to filter by player name

Exporting Data

  • Copy Table: Copies the table to clipboard (paste into Excel)
  • Export PDF: Downloads a PDF file of the current table
  • Export CSV: Downloads a CSV file for use in Excel/Sheets

Database Structure

Players Table

id          - Unique player ID
name        - Player name
points      - Current total points
created_at  - Date created

Transactions Table

id              - Unique transaction ID
player_id       - Reference to player
player_name     - Player name (for easy lookup)
points_added    - Points added (can be negative)
type            - Type (Bonus, Penalty, etc.)
description     - Description of transaction
timestamp       - When transaction occurred

Demo Data

The application comes pre-loaded with 42 cricket players and their initial points from your demo data.

File Structure

CRICKETAPP/
├── server.js              # Express server and API endpoints
├── package.json           # Project dependencies
├── cricketapp.db         # SQLite database (created on first run)
└── public/
    ├── index.html        # HTML interface
    ├── styles.css        # Styling
    └── script.js         # Frontend JavaScript

API Endpoints

Get Players

GET /api/players
Returns: Array of all players with points

Get Single Player

GET /api/players/:id
Returns: Single player object

Add Transaction (Points)

POST /api/transactions
Body: {
    "player_id": 1,
    "player_name": "Ashok Ch",
    "points_added": -50,
    "type": "Bonus",
    "description": "Good performance"
}

Get Transactions

GET /api/transactions
Returns: Array of all transactions

Export CSV

GET /api/export/csv
Returns: CSV file download

Notes

  • Negative Points = Good Performance ✓
  • Positive Points = Penalty ✗
  • Data is saved to SQLite database (cricketapp.db)
  • The application runs on localhost:3000 by default
  • To stop the server, press Ctrl+C in the terminal

Troubleshooting

"Cannot find module" error

Run: npm install

Port 3000 already in use

Either:

  1. Close the application using that port
  2. Change PORT in server.js to another number (e.g., 3001)

Database errors

The database file (cricketapp.db) is created automatically on first run.

Contact & Support

For issues or questions, check that:

  1. Node.js is installed: node --version
  2. npm is installed: npm --version
  3. Dependencies are installed: npm install
  4. Server is running: Open http://localhost:3000

Enjoy using the Cricket Points Calculator! 🏏

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages