Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e7615de98b
|
|||
|
394d71f59c
|
|||
|
b016d58d84
|
|||
|
6232e91925
|
|||
| 7ce4fbd756 | |||
| bb62acfc7f | |||
|
5f6ae79bf0
|
|||
|
697788c20f
|
|||
|
5c5828cfc1
|
|||
|
0a88217443
|
|||
|
2d783778a7
|
32
AGENTS.md
32
AGENTS.md
@@ -26,11 +26,22 @@ yamllint . # YAML linting
|
||||
markdownlint . # Markdown linting
|
||||
```
|
||||
|
||||
### Testing
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run tests (no specific test framework configured)
|
||||
# No formal test framework configured
|
||||
# Project uses manual testing with example PDF files in repository
|
||||
# To test individual functions, run the CLI commands directly:
|
||||
# myice schedule --days 7
|
||||
# myice mobile-login
|
||||
# myice search --help
|
||||
```
|
||||
|
||||
### Running the Web API
|
||||
|
||||
```bash
|
||||
# Or with poetry
|
||||
poetry run fastapi run myice/webapi.py --host 127.0.0.1
|
||||
```
|
||||
|
||||
## Code Style Guidelines
|
||||
@@ -75,3 +86,20 @@ markdownlint . # Markdown linting
|
||||
- requests for HTTP requests
|
||||
- PyPDF2 for PDF processing
|
||||
- Use rich for enhanced console output
|
||||
- Custom rl_ai_tools package for AI functionalities
|
||||
|
||||
### Git Commit Messages
|
||||
|
||||
- Use conventional commits format
|
||||
- Never mention Claude in commit messages
|
||||
- Be descriptive but concise
|
||||
- Use present tense ("add feature" not "added feature")
|
||||
|
||||
### Additional Rules
|
||||
|
||||
- Always use ddg-mcp to perform Web Search functionality
|
||||
- Follow the existing code patterns in myice/myice.py and myice/webapi.py
|
||||
- Maintain backward compatibility when modifying existing APIs
|
||||
- Document new features in README.md
|
||||
- Always run ruff format and ruff check after editing a python file
|
||||
- use conventional commit messages
|
||||
|
||||
185
index.html
185
index.html
@@ -32,16 +32,28 @@
|
||||
<div class="container mt-2" id="mainContent" style="display: none;">
|
||||
|
||||
<div id="eventFilters" style="display: none;">
|
||||
<div class="mb-3">
|
||||
<div class="mb-3 row">
|
||||
<div class="col-md-3">
|
||||
<label for="account" class="form-label">Compte</label>
|
||||
<select id="account" class="form-select">
|
||||
<option value="default">Défaut</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="agegroup" class="form-label">Âge</label>
|
||||
<select id="agegroup" class="form-select">
|
||||
<option value="">Tous</option>
|
||||
</select>
|
||||
<button id="fetchEvents" class="btn btn-primary" style="margin-top: 1.2rem;">Charger</button>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="subgroup" class="form-label">Sous-groupe</label>
|
||||
<select id="subgroup" class="form-select">
|
||||
<option value="">Tous</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex align-items-end">
|
||||
<button id="fetchEvents" class="btn btn-primary">Charger</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -77,6 +89,7 @@
|
||||
const eventFilters = document.getElementById("eventFilters");
|
||||
const accountSelect = document.getElementById("account");
|
||||
const agegroupSelect = document.getElementById("agegroup");
|
||||
const subgroupSelect = document.getElementById("subgroup");
|
||||
const eventList = document.getElementById("eventList");
|
||||
const fetchButton = document.getElementById("fetchEvents");
|
||||
const eventDetailsContent = document.getElementById("eventDetailsContent");
|
||||
@@ -210,9 +223,7 @@
|
||||
}
|
||||
|
||||
eventFilters.style.display = "block";
|
||||
updateAccountOptions();
|
||||
// Don't automatically fetch events on page load
|
||||
// Wait for user to explicitly select an account or click fetch
|
||||
updateAccountOptionsAndLoadEvents();
|
||||
} else {
|
||||
// User is not logged in
|
||||
loginView.style.display = "flex";
|
||||
@@ -255,7 +266,7 @@
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function updateAccountOptions() {
|
||||
function updateAccountOptionsAndLoadEvents() {
|
||||
// Fetch available accounts from the server
|
||||
fetch(`${apiBaseUrl}/accounts`, {
|
||||
headers: { "Authorization": `Bearer ${storedApiKey}` }
|
||||
@@ -306,6 +317,9 @@
|
||||
|
||||
// Set the selected account in the dropdown
|
||||
accountSelect.value = accountToSelect;
|
||||
|
||||
// Automatically fetch events for the selected account
|
||||
fetchEvents(storedApiKey, accountToSelect);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Erreur lors du chargement des comptes:", error);
|
||||
@@ -334,6 +348,12 @@
|
||||
});
|
||||
|
||||
agegroupSelect.addEventListener("change", () => {
|
||||
// Update subgroup options based on selected agegroup
|
||||
updateSubgroupOptions(agegroupSelect.value, lastFetchedEvents);
|
||||
displayEvents(lastFetchedEvents);
|
||||
});
|
||||
|
||||
subgroupSelect.addEventListener("change", () => {
|
||||
displayEvents(lastFetchedEvents);
|
||||
});
|
||||
|
||||
@@ -404,20 +424,69 @@
|
||||
}
|
||||
|
||||
function updateAgeGroupOptions(events) {
|
||||
let agegroups = new Set(events.map(event => `${event.agegroup} ${event.name}`.trim()));
|
||||
let agegroups = new Set(events.map(event => event.agegroup));
|
||||
agegroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||
agegroups.forEach(group => {
|
||||
Array.from(agegroups).sort().forEach(group => {
|
||||
const option = document.createElement("option");
|
||||
option.value = group;
|
||||
option.textContent = group;
|
||||
agegroupSelect.appendChild(option);
|
||||
});
|
||||
|
||||
// Reset subgroup selector
|
||||
subgroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||
}
|
||||
|
||||
function updateSubgroupOptions(selectedAgegroup, events) {
|
||||
// Reset subgroup options
|
||||
subgroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||
|
||||
if (selectedAgegroup === "") {
|
||||
// If no agegroup is selected, disable subgroup selector
|
||||
subgroupSelect.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable subgroup selector
|
||||
subgroupSelect.disabled = false;
|
||||
|
||||
// Extract subgroups from events matching the selected agegroup
|
||||
let subgroups = new Set();
|
||||
events
|
||||
.filter(event => event.agegroup === selectedAgegroup)
|
||||
.forEach(event => {
|
||||
// Extract subgroup from event.name or event.title
|
||||
// This assumes the subgroup is part of the name field
|
||||
if (event.name && event.name !== selectedAgegroup) {
|
||||
subgroups.add(event.name);
|
||||
}
|
||||
});
|
||||
|
||||
// Add subgroups to the selector
|
||||
Array.from(subgroups).sort().forEach(subgroup => {
|
||||
const option = document.createElement("option");
|
||||
option.value = subgroup;
|
||||
option.textContent = subgroup;
|
||||
subgroupSelect.appendChild(option);
|
||||
});
|
||||
}
|
||||
|
||||
function displayEvents(events) {
|
||||
eventList.innerHTML = "";
|
||||
let selectedAgegroup = agegroupSelect.value;
|
||||
let filteredEvents = events.filter(event => event.event === "Jeu" && (selectedAgegroup === "" || `${event.agegroup} ${event.name}` === selectedAgegroup));
|
||||
let selectedSubgroup = subgroupSelect.value;
|
||||
let filteredEvents = events.filter(event => {
|
||||
// Filter by event type
|
||||
if (event.event !== "Jeu") return false;
|
||||
|
||||
// Filter by agegroup
|
||||
if (selectedAgegroup !== "" && event.agegroup !== selectedAgegroup) return false;
|
||||
|
||||
// Filter by subgroup
|
||||
if (selectedSubgroup !== "" && event.name !== selectedSubgroup) return false;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (filteredEvents.length === 0) {
|
||||
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
||||
@@ -430,7 +499,9 @@
|
||||
eventCard.innerHTML = `
|
||||
<div class="card" style="border-left: 5px solid ${event.color}" data-id="${event.id_event}">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">${event.title}</h5>
|
||||
<h5 class="card-title">${event.agegroup} - ${event.name}</h5>
|
||||
<p class="card-text">${event.title}</p>
|
||||
<p class="card-text"><strong>Adversaire:</strong> ${event.opponent}</p>
|
||||
<p class="card-text"><strong>Lieu:</strong> ${event.place}</p>
|
||||
<p class="card-text"><strong>Heure:</strong> ${event.start} - ${event.end}</p>
|
||||
</div>
|
||||
@@ -448,21 +519,107 @@
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const sortedPlayers = data.convocation.available
|
||||
// Check if available players data exists
|
||||
const availablePlayers = data.convocation.available || [];
|
||||
const sortedPlayers = availablePlayers
|
||||
.sort((a, b) => (a.number || 0) - (b.number || 0));
|
||||
|
||||
// Calculate player statistics
|
||||
const totalPlayers = sortedPlayers.length;
|
||||
const positionCount = {};
|
||||
sortedPlayers.forEach(player => {
|
||||
const position = player.position || "N/A";
|
||||
positionCount[position] = (positionCount[position] || 0) + 1;
|
||||
});
|
||||
|
||||
// Generate position breakdown
|
||||
const positionBreakdown = Object.entries(positionCount)
|
||||
.map(([position, count]) => `${position}: ${count}`)
|
||||
.join(', ');
|
||||
|
||||
// Sort players by position first, then by number
|
||||
const playersByPosition = [...sortedPlayers].sort((a, b) => {
|
||||
// Sort by position first
|
||||
const positionA = a.position || "ZZZ"; // Put undefined positions at the end
|
||||
const positionB = b.position || "ZZZ";
|
||||
|
||||
if (positionA !== positionB) {
|
||||
return positionA.localeCompare(positionB);
|
||||
}
|
||||
|
||||
// If positions are the same, sort by number
|
||||
const numA = parseInt(a.number) || 0;
|
||||
const numB = parseInt(b.number) || 0;
|
||||
return numA - numB;
|
||||
});
|
||||
|
||||
// Process staff data
|
||||
const staffList = data.convocation.staff || [];
|
||||
const totalStaff = staffList.length;
|
||||
|
||||
// Check if there are no players
|
||||
if (totalPlayers === 0 && totalStaff === 0) {
|
||||
eventDetailsContent.innerHTML = `
|
||||
<div class="card border-warning">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">${data.title}</h5>
|
||||
<p class="card-text"><strong>Type:</strong> ${data.type}</p>
|
||||
<p class="card-text"><strong>Lieu:</strong> ${data.place}</p>
|
||||
<p class="card-text"><strong>Heure:</strong> ${data.time_start} - ${data.time_end}</p>
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<h6 class="alert-heading">Aucun joueur ni personnel convoqué</h6>
|
||||
<p>Il n'y a actuellement aucun joueur ni personnel convoqué pour ce match.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
} else {
|
||||
let staffHtml = '';
|
||||
if (totalStaff > 0) {
|
||||
staffHtml = `
|
||||
<h6>Personnel (${totalStaff}):</h6>
|
||||
<ul>${staffList.map(staff => {
|
||||
return `<li><strong>${staff.role}:</strong> ${staff.fname} ${staff.lname}</li>`;
|
||||
}).join('')}</ul>
|
||||
`;
|
||||
} else {
|
||||
staffHtml = `
|
||||
<div class="alert alert-info" role="alert">
|
||||
<h6>Aucun personnel convoqué</h6>
|
||||
<p>Il n'y a actuellement aucun personnel convoqué pour ce match.</p>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
if (totalPlayers === 0) {
|
||||
eventDetailsContent.innerHTML = `
|
||||
<h5>${data.title}</h5>
|
||||
<p><strong>Type:</strong> ${data.type}</p>
|
||||
<p><strong>Lieu:</strong> ${data.place}</p>
|
||||
<p><strong>Heure:</strong> ${data.time_start} - ${data.time_end}</p>
|
||||
<h6>Joueurs convoqués:</h6>
|
||||
<ul>${sortedPlayers.map(player => {
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<h6 class="alert-heading">Aucun joueur convoqué</h6>
|
||||
<p>Il n'y a actuellement aucun joueur convoqué pour ce match.</p>
|
||||
</div>
|
||||
${staffHtml}
|
||||
`;
|
||||
} else {
|
||||
eventDetailsContent.innerHTML = `
|
||||
<h5>${data.title}</h5>
|
||||
<p><strong>Type:</strong> ${data.type}</p>
|
||||
<p><strong>Lieu:</strong> ${data.place}</p>
|
||||
<p><strong>Heure:</strong> ${data.time_start} - ${data.time_end}</p>
|
||||
<p><strong>Joueurs convoqués:</strong> ${totalPlayers} joueur${totalPlayers > 1 ? 's' : ''} (${positionBreakdown})</p>
|
||||
<h6>Liste des joueurs:</h6>
|
||||
<ul>${playersByPosition.map(player => {
|
||||
let number = player.number ? player.number : "N/A";
|
||||
let position = player.position ? player.position : "N/A";
|
||||
return `<li>${number} - ${player.fname} ${player.lname} (${position}, ${player.dob})</li>`;
|
||||
return `<li>[${position}] ${number} - ${player.fname} ${player.lname} (${player.dob})</li>`;
|
||||
}).join('')}</ul>
|
||||
${staffHtml}
|
||||
`;
|
||||
}
|
||||
}
|
||||
new bootstrap.Modal(document.getElementById('eventDetailsModal')).show();
|
||||
})
|
||||
.catch(error => console.error("Erreur lors du chargement des détails de l'événement:", error));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "myice"
|
||||
version = "v0.5.3"
|
||||
version = "v0.5.7"
|
||||
description = "myice parsing"
|
||||
authors = [
|
||||
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},
|
||||
|
||||
Reference in New Issue
Block a user