Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
obcode committed Jun 22, 2019
2 parents 97a8f98 + 24e8030 commit c7f8628
Show file tree
Hide file tree
Showing 36 changed files with 2,021 additions and 383 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elexams",
"version": "0.1.0",
"version": "0.2.0",
"description": "A frontend for obcode/plexams server",
"main": "dist/main.js",
"private": true,
Expand All @@ -20,20 +20,20 @@
"author": "Oliver Braun",
"license": "CC0-1.0",
"devDependencies": {
"electron": "^5.0.2",
"electron-builder": "^20.41.0",
"rollup": "^1.12.4",
"electron": "^5.0.3",
"electron-builder": "^20.43.0",
"rollup": "^1.15.3",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-node-resolve": "^5.0.2",
"rollup-plugin-svelte": "^5.1.0",
"rollup-plugin-typescript": "^1.0.1",
"svelte": "^3.4.4",
"tslib": "^1.9.3",
"typescript": "^3.4.5"
"svelte": "^3.5.1",
"tslib": "^1.10.0",
"typescript": "^3.5.2"
},
"dependencies": {
"chokidar": "^3.0.0",
"chokidar": "^3.0.1",
"cross-env": "^5.2.0"
}
}
25 changes: 18 additions & 7 deletions src/components/App.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<script>
import { semesterConfig } from "../stores/main.js";
import { lecturers } from "../stores/lecturers.js";
import Plan from "./Plan.svelte";
import { semesterConfig, validation } from "../stores/main.js";
import { lecturers } from "../stores/lecturers.js";
import { plannedRooms } from "../stores/rooms.js";
import { allAncodes } from "../stores/exams.js";
import Plan from "./ExamPlanning/Plan.svelte";
import Rooms from "./RoomPlanning/Rooms.svelte";
import Invigilation from "./InvigilationPlanning/Invigilation.svelte";
import NTA from "./NTA.svelte";
let info = 1;
let info = 3;
let l = $lecturers; // FIXME: Problem ist Promise in readable
let p = $plannedRooms; // FIXME: Problem ist Promise in readable
let a = $allAncodes; // FIXME: Problem ist Promise in readable
</script>

<style>
td {
vertical-align: 0pt;
}
</style>

<main>
Expand Down Expand Up @@ -40,6 +45,12 @@
{#if info === 1}
<Plan />
{/if}
{#if info === 2}
<Rooms />
{/if}
{#if info === 3}
<Invigilation />
{/if}
{#if info === 4}
<NTA />
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
conflictingSlots,
setConflictingSlots,
resetConflicting,
showRegisteredGroups
} from "../stores/exams.js";
import { selectedLecturer } from "../stores/lecturers.js";
showRegisteredGroups,
showRooms
} from "../../stores/exams.js";
import { semesterConfig } from "../../stores/main.js";
import { selectedLecturer } from "../../stores/lecturers.js";
import { get } from "svelte/store";
import Room from "./Room.svelte";
const notPlannedByMe = !exam.plannedByMe;
const draggable = exam.plannedByMe;
const draggable = !$semesterConfig.scheduleFrozen && exam.plannedByMe;
const reExam = exam.reExam;
let dragged = false;
let invisible = false;
Expand Down Expand Up @@ -82,10 +85,6 @@
}
});
let registeredGroup = false;
showRegisteredGroups.subscribe(b => (registeredGroup = b));
function dragStart(event) {
dragged = true;
draggedElement = this;
Expand Down Expand Up @@ -241,7 +240,7 @@
{#if conflicting}
Student-Conflicts:
<span class="conflictingStudents">{studsWithConflicts}</span>
{:else if registeredGroup}
{:else if $showRegisteredGroups}
{#each exam.registeredGroups as registeredGroup, index}
{#if index > 0},{/if}
<span class="registeredGroup {registeredGroup.registeredGroupDegree}">
Expand All @@ -251,4 +250,12 @@
{:else}
<br />
{/if}
{#if $showRooms}
{#each exam.rooms as room, index}
{#if index > 0}
<br />
{/if}
<Room {room} {exam} />
{/each}
{/if}
</div>
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<script>
import { clickedExamAnCode } from "../stores/exams.js";
import { clickedExamAnCode } from "../../stores/exams.js";
let yes = true;
let exam;
clickedExamAnCode.subscribe(ac => {
fetchExam(ac);
if (ac === 0) {
exam = null;
} else {
fetchExam(ac);
}
});
async function fetchExam(ancode) {
let response = await fetch("http://localhost:8080/exam", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(ancode)
});
exam = await response.json();
if (ancode != 0) {
let response = await fetch("http://localhost:8080/exam", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(ancode)
});
exam = await response.json();
}
}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@
import ExamDetails from "./ExamDetails.svelte";
import ShowExamsByLecturer from "./ShowExamsByLecturer.svelte";
import Unscheduled from "./Unscheduled.svelte";
import Validation from "./Validation.svelte";
import {
fetchValidation,
semesterConfig
} from "../stores/main.js";
import Validation from "../Validation.svelte";
import { fetchValidation, semesterConfig } from "../../stores/main.js";
import {
allAncodes,
refetchExams,
showRegisteredGroups,
showRooms,
selectedExamAnCode,
clickedExamAnCode
} from "../stores/exams.js";
} from "../../stores/exams.js";
import { dateString, weekend } from "../../misc.js";
function toggleShowRegisteredGroups() {
showRegisteredGroups.update(b => !b);
}
function toggleShowRooms() {
showRooms.update(b => !b);
}
let ancode = 0;
function setAncode() {
Expand All @@ -31,28 +36,12 @@
return false;
}
function dateString(date) {
const d = new Date(date);
const options = {
weekday: "short",
year: "2-digit",
month: "2-digit",
day: "2-digit"
};
return d.toLocaleString("de-DE", options);
}
function weekend(date) {
const d = new Date(date);
return d.getDay() === 5;
}
async function reloadPlan() {
const reloadResult = await fetch("http://localhost:8080/reloadPlan");
const jsonResult = await reloadResult.json();
if (jsonResult) {
refetchExams.set([]);
fetchValidation();
fetchValidation("ValidateSchedule");
if (jsonResult[0]) {
let output = "Erfolgreich!!\n";
for (const info of jsonResult[1]) {
Expand Down Expand Up @@ -92,6 +81,7 @@
text-align: center;
}
.days {
min-width: 200px;
background-color: rgb(176, 190, 197);
text-align: center;
}
Expand All @@ -117,13 +107,29 @@
{#if $semesterConfig === undefined || $semesterConfig === null}
Loading...
{:else}
<h1>
Prüfungsplanung
{#if $semesterConfig.scheduleFrozen}(keine Änderungen mehr möglich){/if}
</h1>
<button on:click={reloadPlan}>Reload Plan from Server</button>
Zeige Prüfung mit AnCode:
<input type="number" bind:value={ancode} on:change={setAncode} />
{#if $allAncodes.length > 0}
Zeige Prüfung mit AnCode:
<select bind:value={ancode} on:change={setAncode} name="ancode" id="ancode">
<option value="0">auswählen</option>
{#each $allAncodes as ancode}
<option value={ancode}> {ancode} </option>
{/each}
</select>
{/if}

<ShowExamsByLecturer />
<label>
<input type="checkbox" on:click={toggleShowRegisteredGroups} />
Show Registered Groups
zeige Anmeldungen
</label>
<label>
<input type="checkbox" on:click={toggleShowRooms} />
zeige Räume
</label>
<table>
<tr>
Expand Down Expand Up @@ -170,7 +176,7 @@
<td class="validation">
<ExamDetails />
<hr />
<Validation />
<Validation validateWhat="ValidateSchedule" />
</td>
</tr>
</table>
Expand Down
26 changes: 26 additions & 0 deletions src/components/ExamPlanning/Room.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script>
export let room;
export let exam;
const reserveRoom = room.reserveRoom;
const handicapCompensation = room.handicapCompensation;
</script>

<style>
.R1\.046 {
background-color: red;
}
.R1\.049 {
background-color: rgb(106, 119, 230);
}
.reserveRoom {
background-color: grey;
}
.handicapCompensation {
background-color: yellow;
}
</style>

<span class={room.roomID} class:reserveRoom class:handicapCompensation>
{room.roomID} ({room.studentsInRoom.length}/{room.maxSeats}) - {exam.duration + room.deltaDuration}
Minuten
</span>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { selectedLecturer, lecturers } from "../stores/lecturers.js";
import { selectedLecturer, lecturers } from "../../stores/lecturers.js";
let selected = 0;
function setSelected() {
selectedLecturer.set(selected);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<script>
export let dayIndex;
export let slotIndex;
export let goSlot = false;
import Exam from "./Exam.svelte";
import { fetchValidation } from "../../stores/main.js";
import {
fetchValidation
} from "../stores/main.js";
import {
refetchExams,
conflictingAncodes,
conflictingSlots,
resetConflicting,
clickedExamAnCode,
setConflictingSlots
} from "../stores/exams.js";
export let dayIndex;
export let slotIndex;
export let goSlot = false;
} from "../../stores/exams.js";
let exams = [];
let studentCount = 0;
Expand All @@ -39,7 +38,6 @@
refetchExams.subscribe(v => {
if (v.length === 0 || (v[0] === dayIndex && v[1] === slotIndex)) {
console.log(`fetching exams for slot (${dayIndex}, ${slotIndex})`);
exams = [];
fetchExams();
}
Expand Down
File renamed without changes.
Loading

0 comments on commit c7f8628

Please sign in to comment.