Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shahdivyank committed Nov 13, 2023
1 parent 76b362f commit 3c56291
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/app/api/judging/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function GET() {

try {
const teamsSnapshot = await getDocs(
query(collection(db, "teams"), where("status", "==", "qualify"))
query(collection(db, "teams"), where("status", "==", 1))
);
teamsSnapshot.forEach((doc) => {
const { links, name, rounds, table } = doc.data();
Expand All @@ -50,11 +50,7 @@ export async function GET() {
});

const judgesSnapshot = await getDocs(
query(
collection(db, "users"),
where("role", "array-contains", "judges"),
where("status", "==", "accept")
)
query(collection(db, "users"), where("roles.judges", "==", 1))
);
judgesSnapshot.forEach((doc) => {
const { affiliation, name } = doc.data();
Expand Down
6 changes: 5 additions & 1 deletion src/components/dynamic/ProtectedPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const ProtectedPage = ({ children }) => {
const bypass = ROUTES[pathName].bypass;

useEffect(() => {
if (bypass) {
setConfirmed(true);
return;
}
if (RELEASES.DYNAMIC[pathName] > new Date()) {
setError({
code: 423,
Expand Down Expand Up @@ -65,7 +69,7 @@ const ProtectedPage = ({ children }) => {
{error && (
<Error code={error.code} error={error.error} message={error.message} />
)}
{(confirmed || bypass) && (
{confirmed && (
<>
<title>{title}</title>
<div className="flex justify-center items-start w-full bg-hackathon-page h-screen pt-12 lg:pt-0 z-0">
Expand Down
8 changes: 1 addition & 7 deletions src/components/dynamic/admin/services/judging/Judging.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ import Toolbar from "./Toolbar.jsx";

const Judging = () => {
const [data, setData] = useState(null);
const [judges, setJudges] = useState(null);

return (
<div className="h-full font-poppins flex flex-col py-4 gap-3">
<Title title="Judging" />
<Toolbar
data={data}
setData={setData}
judges={judges}
setJudges={setJudges}
/>
<Toolbar data={data} setData={setData} />
<Table data={data} />
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/dynamic/admin/services/judging/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import axios from "axios";

const tags = ["professor", "industry", "student"];

const Toolbar = ({ data, setData, judges, setJudges }) => {
const Toolbar = ({ data, setData }) => {
const router = useRouter();

const [judges, setJudges] = useState(null);
const [popup, setPopup] = useState({
title: "",
text: "",
Expand Down Expand Up @@ -160,6 +161,7 @@ const Toolbar = ({ data, setData, judges, setJudges }) => {

const load = () => {
axios.get("/api/judging").then((response) => {
console.log(response.data.items);
setData(response.data.items.teams);
setJudges(response.data.items.judges);

Expand Down

0 comments on commit 3c56291

Please sign in to comment.