Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ testem.log
.DS_Store
Thumbs.db
.vs/

# Test files
test-*.xlsx
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,59 @@

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.3.5.

## User Guide

### How to Use the Sorteo Application

This application allows you to conduct a raffle (sorteo) for two companies: **Consultatio** and **Nordelta**, using a single set of prizes.

#### Step 1: Prepare Your Files

You need two Excel files (.xlsx or .xls):

**1. Participants File (Participantes)**
- Required columns:
- **Nombre**: First name
- **Apellido**: Last name
- **DNI**: ID number
- **Empresa**: Company name (must contain "Consultatio" or "Nordelta")
- **¿Participa del torneo?** or **¿Participa en Sorteo?**: Participation status (accepts: True, 1, Si, Yes, or their lowercase variants)
- **¿Asistió?**: Attendance status (accepts: True, 1, Si, Yes, or their lowercase variants)

- The column names are flexible and can appear in any order
- Only participants with both "Participa" and "Asistió" marked as true will be included
- Participants are automatically separated by company

**2. Prizes File (Premios)**
- Required columns:
- **Premio**: Prize name
- **Cantidad**: Quantity (number)

- The same prizes will be used for both companies
- Each company will have its own independent raffle for the same set of prizes

#### Step 2: Load Files

1. Click the **"Cargar"** button next to **PARTICIPANTES**
2. Select your participants Excel file
3. Review the loaded participants (shown separated by company)
4. Click the **"Cargar"** button next to **PREMIOS**
5. Select your prizes Excel file
6. Review the loaded prizes

#### Step 3: Start the Raffle

1. Once both files are loaded, the **"PREPARAR SORTEO"** button will become enabled
2. Click **"PREPARAR SORTEO"** to initialize the raffle
3. Click **"Iniciar"** to begin the drawing
4. The system will automatically assign prizes to winners from both companies

#### Step 4: View Results

- Results are displayed in two columns, one for each company
- Each column shows the prize and the winner
- Results appear progressively as the raffle proceeds

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
Expand All @@ -12,7 +65,7 @@ Run `ng generate component component-name` to generate a new component. You can

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
Run `ng build` to build the project. The build artifacts will be stored in the `docs/` directory.

## Running unit tests

Expand All @@ -25,4 +78,3 @@ Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To u
## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
s
105 changes: 105 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Testing Guide for Excel Upload Feature

## What Changed

### Previous System (Before)
- Required 4 separate .txt files:
- Participants for Consultatio
- Prizes for Consultatio
- Participants for Nordelta
- Prizes for Nordelta
- Manual format: one item per line
- Separate upload per company

### New System (After)
- Requires only 2 .xlsx files:
- One participants file (contains both companies)
- One prizes file (same prizes for both companies)
- Excel format with flexible columns
- Single upload per file type

## Testing Steps

### 1. Prepare Test Files

**Participants Excel (participantes.xlsx)**
Required columns (can be in any order):
- Nombre
- Apellido
- DNI
- Empresa (must contain "Consultatio" or "Nordelta")
- ¿Participa del torneo? (or ¿Participa en Sorteo?) - accepts: True, 1, Si, Yes
- ¿Asistió? - accepts: True, 1, Si, Yes

Example rows:
```
| Nombre | Apellido | DNI | Empresa | ¿Participa del torneo? | ¿Asistió? |
|--------|----------|-----|---------|------------------------|-----------|
| Juan | Pérez | 123 | Consultatio | Si | 1 |
| María | García | 456 | Nordelta | Yes | True |
```

**Prizes Excel (premios.xlsx)**
Required columns:
- Premio (prize name)
- Cantidad (quantity as number)

Example rows:
```
| Premio | Cantidad |
|--------|----------|
| Monopatín | 1 |
| Set de cucharas | 2 |
```

### 2. Test the Application

1. Open the application in a browser
2. Click "Cargar" next to PARTICIPANTES
3. Select the participants Excel file
4. Verify:
- Success message appears
- Participants are shown separated by company
- Count matches expected numbers
5. Click "Cargar" next to PREMIOS
6. Select the prizes Excel file
7. Verify:
- Success message appears
- Prizes are listed with quantities
8. Click "PREPARAR SORTEO" (should be enabled now)
9. Click "Iniciar" to begin the raffle
10. Verify:
- Countdown proceeds
- Results appear for both companies
- Winners are assigned correctly

### 3. Edge Cases to Test

- **Empty files**: Should show error
- **Missing columns**: Should show error with clear message
- **Wrong file format**: Should show error (only .xlsx/.xls accepted)
- **Participants with Participa=No**: Should be filtered out
- **Participants with Asistió=No**: Should be filtered out
- **More prizes than participants**: Should show warning
- **Duplicate participants**: Should be deduplicated by DNI

## Expected Behavior

### Valid Input
- Example files provided in issue work correctly
- Consultatio: 4 participants (from evento_515.xlsx)
- Nordelta: 6 participants (from evento_515.xlsx)
- Prizes: 4 types, 5 total (from Excel Modelo.xlsx)
- Both companies use the same prize pool

### Filtering Logic
- Only participants with BOTH "Participa" = true AND "Asistió" = true
- Truthy values accepted: True, 1, si, SI, Si, yes, YES, Yes
- Case-insensitive matching for company names

### Results Display
- Two columns showing winners
- Left column: Consultatio winners
- Right column: Nordelta winners
- Each showing: Prize | Winner name
- Results appear progressively during raffle
Loading