-
Notifications
You must be signed in to change notification settings - Fork 0
Bugged branch review #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
14f63dc
942b486
79b47c3
2da1e8c
c86b230
999aec5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| const express = require('express'); | ||||||
| const router = express.Router(); | ||||||
| const mongoose = require('mongoose'); | ||||||
|
|
||||||
| const Event = require('../models/event_registration'); | ||||||
|
|
||||||
| router.get("/events-count", async (req, res) => { | ||||||
|
||||||
| router.get("/events-count", async (req, res) => { | |
| router.get("/event-count", async (req, res) => { |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response field is named count but in dashboard.js the frontend expects totalUsers. This mismatch means eventCount will always be set to 0 (the fallback value), even when the API call succeeds.
| res.status(200).json({ count: count }); | |
| res.status(200).json({ totalUsers: count }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ require("dotenv").config(); // Load environment variables | |||||
| const express = require("express"); // Import Express.js | ||||||
| const session = require("express-session"); // Import Express Session | ||||||
| const crypto = require("crypto"); // Import Crypto.js | ||||||
| const { Server } = require("socket.io"); // Socket.io for realtime updates | ||||||
| const { Server } = require("socket.io"); // Using the Server class from the socket.io module for realtime update | ||||||
|
||||||
| const { Server } = require("socket.io"); // Using the Server class from the socket.io module for realtime update | |
| const { Server } = require("socket.io"); // Using the Server class from the socket.io module for real-time updates |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header check uses req.headers['X-Allowed-Origin'] but HTTP headers are case-insensitive and typically normalized to lowercase by Express. This should be req.headers['x-allowed-origin'] (lowercase) to work correctly.
| if (req.headers['X-Allowed-Origin'] !== 'testsavi.amritaiedc.site') { | |
| if (req.headers['x-allowed-origin'] !== 'testsavi.amritaiedc.site') { |
Copilot
AI
Dec 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The route imports have been reordered, but the critical issue is that EventRoutes now points to ./routes/event instead of the previous ./routes/eventManager. Additionally, UserAdd route import (from ./routes/addusers) has been completely removed without adding equivalent functionality elsewhere. This will break any endpoints that were defined in those files.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,56 @@ | ||
| import React from "react"; | ||
| import { Card, CardContent, Typography } from "@mui/material"; | ||
| import { ArrowForward } from "@mui/icons-material"; // Import Arrow Icon | ||
| import { ArrowForward } from "@mui/icons-material"; | ||
| import CountUp from "react-countup"; | ||
|
|
||
| const MetricCard = ({ title, value, darkMode, height, width, description, additionalInfo }) => { | ||
| const MetricCard = ({ title, value, darkMode, height, width, description, additionalInfo, bgColor }) => { | ||
| const isNumeric = !isNaN(Number(value)); | ||
|
|
||
| return ( | ||
| <Card | ||
| sx={{ | ||
| backgroundColor: darkMode ? "#1b1c1e" : "#f7f7f7", | ||
| backgroundColor: bgColor || (darkMode ? "#1b1c1e" : "#f7f7f7"), | ||
| borderRadius: 2, | ||
| boxShadow: "0px 4px 8px rgba(0, 0, 0, 0.1)", | ||
| boxShadow: "0px 4px 8px rgba(32, 24, 24, 0.1)", | ||
| padding: "20px", | ||
| height: height, | ||
| width: width, | ||
| transition: "all 0.3s ease", | ||
| transition: "all 0.3s ease-in-out", | ||
| "&:hover": { | ||
| boxShadow: "0px 6px 12px rgba(0, 0, 0, 0.15)", | ||
| backgroundColor: "#2f3134", | ||
| boxShadow: `0px 0px 15px ${bgColor ? bgColor : "#00e676"}`, | ||
| transform: "scale(1.05)", | ||
| }, | ||
| }} | ||
| > | ||
| <CardContent> | ||
| {/* Event Name */} | ||
| <Typography variant="h6" sx={{ fontSize: "20px", fontWeight: "600", color: darkMode ? "#787878" : "#8d8c8c" }}> | ||
| <Typography variant="h6" sx={{ fontSize: "20px", fontWeight: "600", color: "#fff" }}> | ||
| {title} | ||
| </Typography> | ||
|
|
||
| {/* Venue or Numeric Value */} | ||
| <Typography variant="h5" sx={{ fontSize: "16px", fontWeight: "600", color: darkMode ? "#a9a9a9" : "#000" }}> | ||
| <Typography variant="h5" sx={{ fontSize: "16px", fontWeight: "600", color: "#fff" }}> | ||
| {isNumeric ? <CountUp end={Number(value)} duration={2} separator="," /> : value} | ||
| </Typography> | ||
|
|
||
| {/* Coordinator */} | ||
| {description && ( | ||
| <Typography variant="body2" sx={{ color: darkMode ? "#a9a9a9" : "#000", marginTop: "8px" }}> | ||
| <Typography variant="body2" sx={{ color: "#fff", marginTop: "8px" }}> | ||
| {description} | ||
| </Typography> | ||
| )} | ||
|
|
||
| {/* Additional Info (View Link Aligned to Right with Bright Blue Color and Arrow) */} | ||
| {additionalInfo && ( | ||
| <div style={{ marginTop: "10px", display: "flex", justifyContent: "flex-end", alignItems: "center" }}> | ||
| <a | ||
| href={`/events/${title.toLowerCase().replace(/\s+/g, "-")}`} | ||
| style={{ | ||
| textDecoration: "none", | ||
| color: "#007BFF", // Bright Blue Color | ||
| color: "#fff", | ||
| fontWeight: "bold", | ||
| display: "flex", | ||
| alignItems: "center", | ||
| }} | ||
| > | ||
| View | ||
| <ArrowForward sx={{ marginLeft: "5px", color: "#007BFF" }} /> {/* Bright Blue Arrow */} | ||
| <ArrowForward sx={{ marginLeft: "5px", color: "#fff" }} /> | ||
|
Comment on lines
+26
to
+53
|
||
| </a> | ||
| </div> | ||
| )} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable mongoose.