Skip to content

Commit

Permalink
Merge pull request #11 from JohanGrims/10-students
Browse files Browse the repository at this point in the history
10 students
  • Loading branch information
JohanGrims authored Oct 5, 2024
2 parents d2ca0b8 + 43f3d27 commit 75bd14b
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 17 deletions.
9 changes: 5 additions & 4 deletions python/assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def assign():
print(num_participants, num_courses)

# create scores
scores = {"first": 1, "second": 2, "third": 4}
# scores = {"first": 1, "second": 2, "third": 4}
scores = [1, 2, 4]

# create the LP problem
problem = pulp.LpProblem("CourseAssignment", pulp.LpMinimize)
Expand All @@ -101,15 +102,15 @@ def assign():
problem += pulp.lpSum(
(
preferences[list(student_ids.keys())[i]].get(
"points", [scores["first"], scores["second"], scores["third"]]
"points", [scores[0], scores[1], scores[2]]
)[0]
* x[i, student_preferences[i][0]]
+ preferences[list(student_ids.keys())[i]].get(
"points", [scores["first"], scores["second"], scores["third"]]
"points", [scores[0], scores[1], scores[2]]
)[1]
* x[i, student_preferences[i][1]]
+ preferences[list(student_ids.keys())[i]].get(
"points", [scores["first"], scores["second"], scores["third"]]
"points", [scores[0], scores[1], scores[2]]
)[2]
* x[i, student_preferences[i][2]]
)
Expand Down
8 changes: 4 additions & 4 deletions src/admin/NewVote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export default function NewVote() {
}

async function publish() {
const id = generateRandomHash();
console.log("Generating new vote with id: " + id);
const berlinStartTime = moment.tz(startTime, "Europe/Berlin").toDate();
const berlinEndTime = moment.tz(endTime, "Europe/Berlin").toDate();
Expand Down Expand Up @@ -137,14 +136,14 @@ export default function NewVote() {
<div className="fields-row">
<mdui-tooltip
variant="rich"
content="Wählen Sie die Anzahl der Wahlen, die Ihre Schüler treffen müssen (1. Wahl, 2. Wahl etc.)."
headline="Anzahl der Wahlen"
content="Wählen Sie die Anzahl der Wahlen, die Ihre Schüler treffen müssen (1. Wahl, 2. Wahl etc.). Achtung: Die Automatische Zuordnung funktioniert nur mit 3 Wahlen."
>
<mdui-text-field
class="number-input"
label="Anzahl der Wahlen"
type="number"
placeholder="3"
disabled
min={1}
max={10}
value={selectCount}
Expand Down Expand Up @@ -229,13 +228,14 @@ export default function NewVote() {
description:
"Ändern Sie die ID der Wahl. Diese erscheint in der URL (waldorfwahlen.de/[ID]). Achten Sie darauf, dass die ID eindeutig ist und keine Sonderzeichen enthält.",
inputType: "text",
confirmText: "Schließen",
cancelText: "",
textFieldOptions: {
value: id,
onInput: (e) => setId(e.target.value),
placeholder: "spw24",
label: "ID",
},
onConfirm: (value) => setId(value),
});
}}
>
Expand Down
34 changes: 34 additions & 0 deletions src/admin/Overview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,32 @@ export default function Overview() {
return (
<div className="mdui-prose">
<h2>Übersicht</h2>
<mdui-card
variant="outlined"
style={{ width: "100%", padding: "20px" }}
clickable
onClick={() => navigate("/admin/students")}
>
<div
className="mdui-prose"
style={{ width: "100%", userSelect: "none" }}
>
<div
style={{
display: "flex",
textWrap: "nowrap",
gap: "10px",
}}
>
<h2>SchülerInnen</h2>
<mdui-icon name="people"></mdui-icon>
</div>
Verwalten Sie die Datenbank der SchülerInnen, fügen Sie neue
SchülerInnen hinzu und bearbeiten Sie bestehende Klassenlisten.
</div>
</mdui-card>
<p />
<br />
<div
style={{
display: "grid",
Expand Down Expand Up @@ -55,6 +80,15 @@ export default function Overview() {
</p>
</mdui-card>
</div>
{/* <mdui-fab
icon="add"
onClick={() => navigate("/admin/new")}
style={{ position: "fixed", bottom: "20px", right: "20px" }}
extended
variant="surface"
>
Neue Wahl
</mdui-fab> */}
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/admin/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
updateEmail,
updatePassword,
} from "firebase/auth";
import { snackbar } from "mdui";
import { setTheme, snackbar } from "mdui";
import React from "react";
import { auth } from "../firebase";

Expand Down Expand Up @@ -65,6 +65,7 @@ export default function Settings() {
"theme",
switchRef.current.checked ? "dark" : "light"
);
setTheme(switchRef.current.checked ? "dark" : "light");
};

switchRef.current.addEventListener("change", handleToggle);
Expand Down
Loading

0 comments on commit 75bd14b

Please sign in to comment.