Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Fixed bug where selecting then unselecting an empty slot (with officers available) on individual inductee view would cause color to appear.
  • Loading branch information
ryanyychen committed Dec 25, 2024
1 parent e9493ca commit fe78ad2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 12 additions & 6 deletions frontend/src/Pages/InterviewSchedule.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script>
import Layout from "../Layout.svelte";
import { onMount } from "svelte";
import { generateSchedule, UNAVAILABLE_COLOR, AVAILABLE_COLOR, SELECTED_COLOR, NUM_DAYS, NUM_SLOTS } from "./interviewscheduleutils.js"
import { generateSchedule, UNAVAILABLE_COLOR, MAX_GRADIENT_COLOR, SELECTED_COLOR, NUM_DAYS, NUM_SLOTS } from "./interviewscheduleutils.js"
let availabilities;
let inductee_availabilities = {};
Expand Down Expand Up @@ -51,9 +51,11 @@
try {
if (inductee_option[0] == 'all') {
timeslot.style.background = inductee_slot_colors[availabilities[day][slot]['inductees'].length]
} else {
} else if (inductee_availabilities[inductee_option[0]][day][slot] == 1) {
let officer_slot_colors = setColorsOfficers(inductee_availabilities[inductee_option[0]]);
timeslot.style.background = officer_slot_colors[availabilities[day][slot]['officers'].length];
} else {
timeslot.style.background = UNAVAILABLE_COLOR;
}
} catch {
timeslot.style.background = UNAVAILABLE_COLOR;
Expand All @@ -66,9 +68,11 @@
try {
if (inductee_option[0] == 'all') {
timeslot.style.background = inductee_slot_colors[availabilities[day][slot]['inductees'].length]
} else {
} else if (inductee_availabilities[inductee_option[0]][day][slot] == 1) {
let officer_slot_colors = setColorsOfficers(inductee_availabilities[inductee_option[0]]);
timeslot.style.background = officer_slot_colors[availabilities[day][slot]['officers'].length];
} else {
timeslot.style.background = UNAVAILABLE_COLOR;
}
} catch {
timeslot.style.background = UNAVAILABLE_COLOR;
Expand All @@ -80,9 +84,11 @@
try {
if (inductee_option[0] == 'all') {
timeslot.style.background = inductee_slot_colors[availabilities[day][slot]['inductees'].length]
} else {
} else if (inductee_availabilities[inductee_option[0]][day][slot] == 1) {
let officer_slot_colors = setColorsOfficers(inductee_availabilities[inductee_option[0]]);
timeslot.style.background = officer_slot_colors[availabilities[day][slot]['officers'].length];
} else {
timeslot.style.background = UNAVAILABLE_COLOR;
}
} catch {
timeslot.style.background = UNAVAILABLE_COLOR;
Expand Down Expand Up @@ -193,7 +199,7 @@
}
}
let avail_color = AVAILABLE_COLOR.split(",");
let avail_color = MAX_GRADIENT_COLOR.split(",");
let r = avail_color[0].split("(")[1];
let g = avail_color[1];
let b = avail_color[2].split(")")[0];
Expand Down Expand Up @@ -226,7 +232,7 @@
}
}
let avail_color = AVAILABLE_COLOR.split(",");
let avail_color = MAX_GRADIENT_COLOR.split(",");
let r = avail_color[0].split("(")[1];
let g = avail_color[1];
let b = avail_color[2].split(")")[0];
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/Pages/interviewscheduleutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const START_TIME = new Date(1970, 0, 1, 8, 0);

/* --- STYLES --- */
export const UNAVAILABLE_COLOR = "rgba(234, 166, 62, 0.4)";
export const AVAILABLE_COLOR = "rgba(0, 0, 255)";
export const AVAILABLE_COLOR = "rgba(92, 185, 240)";
export const MAX_GRADIENT_COLOR = "rgba(0, 0, 255)";
export const SELECTED_COLOR = "rgba(218, 106, 107)";
const LINE_COLOR = AVAILABLE_COLOR;
const LINE_COLOR = MAX_GRADIENT_COLOR;

// For each column in schedule
const DAY_COL = "display: flex; flex-direction: column;";
Expand Down

0 comments on commit fe78ad2

Please sign in to comment.