Compare commits
17
Commits
v0.5.6
..
a3d4114044
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3d4114044
|
||
|
|
cec54a45d7
|
||
|
|
3efa7101e1
|
||
|
|
861ff0650f
|
||
|
|
73f72d1bbe
|
||
|
|
a407a108ed
|
||
|
|
d6277d7766
|
||
|
|
5b1d741a16
|
||
|
|
5957868e0f
|
||
|
|
525d3bf326
|
||
|
|
0e1eb0da3f
|
||
|
|
4b81cc7f9f
|
||
|
|
c4d9236b16
|
||
|
|
2a5883375f
|
||
|
|
c4b6e39e9e
|
||
|
|
d3b5b6b6fd
|
||
|
|
bcde9fccf5
|
No files matched your search
+11
-104
@@ -41,10 +41,6 @@
|
|||||||
<select id="agegroup" class="form-select">
|
<select id="agegroup" class="form-select">
|
||||||
<option value="">Tous</option>
|
<option value="">Tous</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="subgroup" class="form-label">Sous-groupe</label>
|
|
||||||
<select id="subgroup" class="form-select">
|
|
||||||
<option value="">Tous</option>
|
|
||||||
</select>
|
|
||||||
<button id="fetchEvents" class="btn btn-primary" style="margin-top: 1.2rem;">Charger</button>
|
<button id="fetchEvents" class="btn btn-primary" style="margin-top: 1.2rem;">Charger</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,7 +77,6 @@
|
|||||||
const eventFilters = document.getElementById("eventFilters");
|
const eventFilters = document.getElementById("eventFilters");
|
||||||
const accountSelect = document.getElementById("account");
|
const accountSelect = document.getElementById("account");
|
||||||
const agegroupSelect = document.getElementById("agegroup");
|
const agegroupSelect = document.getElementById("agegroup");
|
||||||
const subgroupSelect = document.getElementById("subgroup");
|
|
||||||
const eventList = document.getElementById("eventList");
|
const eventList = document.getElementById("eventList");
|
||||||
const fetchButton = document.getElementById("fetchEvents");
|
const fetchButton = document.getElementById("fetchEvents");
|
||||||
const eventDetailsContent = document.getElementById("eventDetailsContent");
|
const eventDetailsContent = document.getElementById("eventDetailsContent");
|
||||||
@@ -215,7 +210,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
eventFilters.style.display = "block";
|
eventFilters.style.display = "block";
|
||||||
updateAccountOptionsAndLoadEvents();
|
updateAccountOptions();
|
||||||
|
// Don't automatically fetch events on page load
|
||||||
|
// Wait for user to explicitly select an account or click fetch
|
||||||
} else {
|
} else {
|
||||||
// User is not logged in
|
// User is not logged in
|
||||||
loginView.style.display = "flex";
|
loginView.style.display = "flex";
|
||||||
@@ -258,7 +255,7 @@
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAccountOptionsAndLoadEvents() {
|
function updateAccountOptions() {
|
||||||
// Fetch available accounts from the server
|
// Fetch available accounts from the server
|
||||||
fetch(`${apiBaseUrl}/accounts`, {
|
fetch(`${apiBaseUrl}/accounts`, {
|
||||||
headers: { "Authorization": `Bearer ${storedApiKey}` }
|
headers: { "Authorization": `Bearer ${storedApiKey}` }
|
||||||
@@ -309,9 +306,6 @@
|
|||||||
|
|
||||||
// Set the selected account in the dropdown
|
// Set the selected account in the dropdown
|
||||||
accountSelect.value = accountToSelect;
|
accountSelect.value = accountToSelect;
|
||||||
|
|
||||||
// Automatically fetch events for the selected account
|
|
||||||
fetchEvents(storedApiKey, accountToSelect);
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Erreur lors du chargement des comptes:", error);
|
console.error("Erreur lors du chargement des comptes:", error);
|
||||||
@@ -340,12 +334,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
agegroupSelect.addEventListener("change", () => {
|
agegroupSelect.addEventListener("change", () => {
|
||||||
// Update subgroup options based on selected agegroup
|
|
||||||
updateSubgroupOptions(agegroupSelect.value, lastFetchedEvents);
|
|
||||||
displayEvents(lastFetchedEvents);
|
|
||||||
});
|
|
||||||
|
|
||||||
subgroupSelect.addEventListener("change", () => {
|
|
||||||
displayEvents(lastFetchedEvents);
|
displayEvents(lastFetchedEvents);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -416,69 +404,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateAgeGroupOptions(events) {
|
function updateAgeGroupOptions(events) {
|
||||||
let agegroups = new Set(events.map(event => event.agegroup));
|
let agegroups = new Set(events.map(event => `${event.agegroup} ${event.name}`.trim()));
|
||||||
agegroupSelect.innerHTML = '<option value="">Tous</option>';
|
agegroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||||
Array.from(agegroups).sort().forEach(group => {
|
agegroups.forEach(group => {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
option.value = group;
|
option.value = group;
|
||||||
option.textContent = group;
|
option.textContent = group;
|
||||||
agegroupSelect.appendChild(option);
|
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) {
|
function displayEvents(events) {
|
||||||
eventList.innerHTML = "";
|
eventList.innerHTML = "";
|
||||||
let selectedAgegroup = agegroupSelect.value;
|
let selectedAgegroup = agegroupSelect.value;
|
||||||
let selectedSubgroup = subgroupSelect.value;
|
let filteredEvents = events.filter(event => event.event === "Jeu" && (selectedAgegroup === "" || `${event.agegroup} ${event.name}` === selectedAgegroup));
|
||||||
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) {
|
if (filteredEvents.length === 0) {
|
||||||
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
||||||
@@ -491,9 +430,7 @@
|
|||||||
eventCard.innerHTML = `
|
eventCard.innerHTML = `
|
||||||
<div class="card" style="border-left: 5px solid ${event.color}" data-id="${event.id_event}">
|
<div class="card" style="border-left: 5px solid ${event.color}" data-id="${event.id_event}">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">${event.agegroup} - ${event.name}</h5>
|
<h5 class="card-title">${event.title}</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>Lieu:</strong> ${event.place}</p>
|
||||||
<p class="card-text"><strong>Heure:</strong> ${event.start} - ${event.end}</p>
|
<p class="card-text"><strong>Heure:</strong> ${event.start} - ${event.end}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -514,46 +451,16 @@
|
|||||||
const sortedPlayers = data.convocation.available
|
const sortedPlayers = data.convocation.available
|
||||||
.sort((a, b) => (a.number || 0) - (b.number || 0));
|
.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;
|
|
||||||
});
|
|
||||||
|
|
||||||
eventDetailsContent.innerHTML = `
|
eventDetailsContent.innerHTML = `
|
||||||
<h5>${data.title}</h5>
|
<h5>${data.title}</h5>
|
||||||
<p><strong>Type:</strong> ${data.type}</p>
|
<p><strong>Type:</strong> ${data.type}</p>
|
||||||
<p><strong>Lieu:</strong> ${data.place}</p>
|
<p><strong>Lieu:</strong> ${data.place}</p>
|
||||||
<p><strong>Heure:</strong> ${data.time_start} - ${data.time_end}</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>Joueurs convoqués:</h6>
|
||||||
<h6>Liste des joueurs:</h6>
|
<ul>${sortedPlayers.map(player => {
|
||||||
<ul>${playersByPosition.map(player => {
|
|
||||||
let number = player.number ? player.number : "N/A";
|
let number = player.number ? player.number : "N/A";
|
||||||
let position = player.position ? player.position : "N/A";
|
let position = player.position ? player.position : "N/A";
|
||||||
return `<li>[${position}] ${number} - ${player.fname} ${player.lname} (${player.dob})</li>`;
|
return `<li>${number} - ${player.fname} ${player.lname} (${position}, ${player.dob})</li>`;
|
||||||
}).join('')}</ul>
|
}).join('')}</ul>
|
||||||
`;
|
`;
|
||||||
new bootstrap.Modal(document.getElementById('eventDetailsModal')).show();
|
new bootstrap.Modal(document.getElementById('eventDetailsModal')).show();
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ from . import myice
|
|||||||
# OIDC Configuration
|
# OIDC Configuration
|
||||||
CLIENT_ID = os.environ.get("CLIENT_ID", "8ea04fbb-4237-4b1d-a895-0b3575a3af3f")
|
CLIENT_ID = os.environ.get("CLIENT_ID", "8ea04fbb-4237-4b1d-a895-0b3575a3af3f")
|
||||||
CLIENT_SECRET = os.environ.get(
|
CLIENT_SECRET = os.environ.get(
|
||||||
"CLIENT_SECRET", "REDACTED_CLIENT_SECRET"
|
"CLIENT_SECRET", "5iXycu7aU6o9e17NNTOUeetQkRkBqQlomoD2hTyLGLTAcwj0dwkkLH3mz1IrZSmJ"
|
||||||
)
|
)
|
||||||
REDIRECT_URI = os.environ.get("REDIRECT_URI", "http://localhost:8000/callback")
|
REDIRECT_URI = os.environ.get("REDIRECT_URI", "http://localhost:8000/callback")
|
||||||
AUTHORIZATION_ENDPOINT = "https://login.infomaniak.com/authorize"
|
AUTHORIZATION_ENDPOINT = "https://login.infomaniak.com/authorize"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "myice"
|
name = "myice"
|
||||||
version = "v0.5.6"
|
version = "v0.5.3"
|
||||||
description = "myice parsing"
|
description = "myice parsing"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},
|
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},
|
||||||
|
|||||||
Reference in new issue
Block a user