@dytsou/intern-corner-scheduler 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dytsou/intern-corner-scheduler",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Round-table Scheduler (CP-SAT) - Python CLI and web interface using OR-Tools CP-SAT to generate round-table seating across rounds with fixed hosts, balanced tables, and pair-wise constraints",
|
|
6
6
|
"author": "dytsou",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
1
|
+
import { writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
3
|
|
|
4
4
|
// Create .nojekyll file in docs directory for GitHub Pages
|
|
5
5
|
const nojekyllPath = join(process.cwd(), 'docs', '.nojekyll');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
function PairInput({ pair, pairLabel, helpId, onChange, onRemove }) {
|
|
2
2
|
const handleUChange = (e) => {
|
|
3
3
|
const value = e.target.value;
|
|
4
|
-
onChange('u', value === '' ? '' : parseInt(value) || '');
|
|
4
|
+
onChange('u', value === '' ? '' : Number.parseInt(value, 10) || '');
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
const handleVChange = (e) => {
|
|
8
8
|
const value = e.target.value;
|
|
9
|
-
onChange('v', value === '' ? '' : parseInt(value) || '');
|
|
9
|
+
onChange('v', value === '' ? '' : Number.parseInt(value, 10) || '');
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
return (
|
|
@@ -6,8 +6,14 @@ function PairStatus({ schedule }) {
|
|
|
6
6
|
<div className="pair-status-section">
|
|
7
7
|
<h3>{title}</h3>
|
|
8
8
|
<div className="pair-list">
|
|
9
|
-
{pairs.map((pair
|
|
10
|
-
<span
|
|
9
|
+
{pairs.map((pair) => (
|
|
10
|
+
<span
|
|
11
|
+
key={pair
|
|
12
|
+
.slice()
|
|
13
|
+
.sort((left, right) => left - right)
|
|
14
|
+
.join('-')}
|
|
15
|
+
className={`pair-badge ${className}`}
|
|
16
|
+
>
|
|
11
17
|
{pair[0]} × {pair[1]}
|
|
12
18
|
</span>
|
|
13
19
|
))}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
2
|
import PairInput from './PairInput';
|
|
3
3
|
|
|
4
4
|
function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
@@ -8,13 +8,14 @@ function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
|
8
8
|
const [timeLimit, setTimeLimit] = useState(60);
|
|
9
9
|
const [sameOncePairs, setSameOncePairs] = useState([]);
|
|
10
10
|
const [neverTogetherPairs, setNeverTogetherPairs] = useState([]);
|
|
11
|
+
const nextPairId = useRef(0);
|
|
11
12
|
|
|
12
13
|
const handleSubmit = (e) => {
|
|
13
14
|
e.preventDefault();
|
|
14
15
|
|
|
15
|
-
const participantsNum = parseInt(participants);
|
|
16
|
-
const tablesNum = parseInt(tables);
|
|
17
|
-
const roundsNum = parseInt(rounds);
|
|
16
|
+
const participantsNum = Number.parseInt(participants, 10);
|
|
17
|
+
const tablesNum = Number.parseInt(tables, 10);
|
|
18
|
+
const roundsNum = Number.parseInt(rounds, 10);
|
|
18
19
|
|
|
19
20
|
// Validation
|
|
20
21
|
if (tablesNum > participantsNum) {
|
|
@@ -51,11 +52,17 @@ function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
const addSameOncePair = () => {
|
|
54
|
-
setSameOncePairs([
|
|
55
|
+
setSameOncePairs([
|
|
56
|
+
...sameOncePairs,
|
|
57
|
+
{ id: nextPairId.current++, u: '', v: '' },
|
|
58
|
+
]);
|
|
55
59
|
};
|
|
56
60
|
|
|
57
61
|
const addNeverTogetherPair = () => {
|
|
58
|
-
setNeverTogetherPairs([
|
|
62
|
+
setNeverTogetherPairs([
|
|
63
|
+
...neverTogetherPairs,
|
|
64
|
+
{ id: nextPairId.current++, u: '', v: '' },
|
|
65
|
+
]);
|
|
59
66
|
};
|
|
60
67
|
|
|
61
68
|
const updateSameOncePair = (index, field, value) => {
|
|
@@ -153,7 +160,9 @@ function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
|
153
160
|
max="300"
|
|
154
161
|
aria-describedby="time-limit-help"
|
|
155
162
|
value={timeLimit}
|
|
156
|
-
onChange={(e) =>
|
|
163
|
+
onChange={(e) =>
|
|
164
|
+
setTimeLimit(Number.parseInt(e.target.value, 10))
|
|
165
|
+
}
|
|
157
166
|
/>
|
|
158
167
|
<small id="time-limit-help">
|
|
159
168
|
Maximum time for the solver (1-300 seconds)
|
|
@@ -180,7 +189,7 @@ function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
|
180
189
|
<div className="pairs-container">
|
|
181
190
|
{sameOncePairs.map((pair, index) => (
|
|
182
191
|
<PairInput
|
|
183
|
-
key={
|
|
192
|
+
key={pair.id}
|
|
184
193
|
pair={pair}
|
|
185
194
|
pairLabel={`Same-once pair ${index + 1}`}
|
|
186
195
|
helpId="same-once-help"
|
|
@@ -211,7 +220,7 @@ function ScheduleForm({ onSubmit, onCancel, loading, cancelling }) {
|
|
|
211
220
|
<div className="pairs-container">
|
|
212
221
|
{neverTogetherPairs.map((pair, index) => (
|
|
213
222
|
<PairInput
|
|
214
|
-
key={
|
|
223
|
+
key={pair.id}
|
|
215
224
|
pair={pair}
|
|
216
225
|
pairLabel={`Never-together pair ${index + 1}`}
|
|
217
226
|
helpId="never-together-help"
|
|
@@ -7,7 +7,13 @@ function TableAssignments({ schedule, currentRound }) {
|
|
|
7
7
|
<h3 className="round-title">Round {currentRound + 1}</h3>
|
|
8
8
|
<div className="tables-grid">
|
|
9
9
|
{roundAssignments.map((table, tableIndex) => (
|
|
10
|
-
<div
|
|
10
|
+
<div
|
|
11
|
+
key={table
|
|
12
|
+
.slice()
|
|
13
|
+
.sort((left, right) => left - right)
|
|
14
|
+
.join('-')}
|
|
15
|
+
className="table-card"
|
|
16
|
+
>
|
|
11
17
|
<div className="table-header">
|
|
12
18
|
<span className="table-number">Table {tableIndex + 1}</span>
|
|
13
19
|
<span className="table-size">
|