Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Students/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"tailwindcss": "^3.3.1",
"vite": "^4.2.0"
},
"proxy": "http://localhost:5000"
"proxy": "https://ckodon-api-backend.onrender.com"
}
14 changes: 7 additions & 7 deletions Students/src/app/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import axios from 'axios';


export async function getASpecificReview(id) {
let response = await axios.get(`http://localhost:5000/undergradeReviews/id/${id}`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/undergradeReviews/id/${id}`)
if(!response.status == 200){
throw {
message: "Failed to fetch Review",
Expand All @@ -18,7 +18,7 @@ import axios from 'axios';
}

export async function getAUserReview(id) {
let response = await axios.get(`http://localhost:5000/undergradeReviews/user/${id}`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/undergradeReviews/user/${id}`)
if(!response.status == 200){


Expand All @@ -35,7 +35,7 @@ export async function getAUserReview(id) {


export async function getAUserHonor(id) {
let response = await axios.get(`http://localhost:5000/honors/user/643e93e228fe348dc275fe37`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/honors/user/643e93e228fe348dc275fe37`)
if(!response.status == 200){
throw {
message: "Failed to fetch Honor",
Expand All @@ -50,7 +50,7 @@ export async function getAUserHonor(id) {
}

export async function getAUserActivity(id) {
let response = await axios.get(`http://localhost:5000/activities/user/643e93e228fe348dc275fe37`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/activities/user/643e93e228fe348dc275fe37`)
if(!response.status == 200){
throw {
message: "Failed to fetch Activity",
Expand All @@ -65,7 +65,7 @@ export async function getAUserActivity(id) {
}

export async function getAUserAid(id) {
let response = await axios.get(`http://localhost:5000/aids/user/643e93e228fe348dc275fe37`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/aids/user/643e93e228fe348dc275fe37`)
if(!response.status == 200){
throw {
message: "Failed to fetch Aid",
Expand All @@ -80,7 +80,7 @@ export async function getAUserAid(id) {
}

export async function getAUserEssay(id) {
let response = await axios.get(`http://localhost:5000/essays/user/643e93e228fe348dc275fe37`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/essays/user/643e93e228fe348dc275fe37`)
if(!response.status == 200){
throw {
message: "Failed to fetch Essay",
Expand All @@ -95,7 +95,7 @@ export async function getAUserEssay(id) {
}

export async function getAUserRecommendation(id) {
let response = await axios.get(`http://localhost:5000/recommendations/user/643e93e228fe348dc275fe37`)
let response = await axios.get(`https://ckodon-api-backend.onrender.com/recommendations/user/643e93e228fe348dc275fe37`)
if(!response.status == 200){
throw {
message: "Failed to fetch Recommendation",
Expand Down
6 changes: 2 additions & 4 deletions Students/src/app/api/apiSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import { setCredentials } from '../../features/auth/authSlice'

const baseQuery = fetchBaseQuery({
baseUrl: 'http://localhost:5000',
baseUrl: 'https://ckodon-api-backend.onrender.com',
credentials: 'include',
prepareHeaders: (headers, { getState }) => {
const token = getState().auth.token
Expand All @@ -15,9 +15,7 @@ const baseQuery = fetchBaseQuery({
})

const baseQueryWithReauth = async (args, api, extraOptions) => {
// console.log(args) // request url, method, body
// console.log(api) // signal, dispatch, getState()
// console.log(extraOptions) //custom like {shout: true}


let result = await baseQuery(args, api, extraOptions)

Expand Down
195 changes: 99 additions & 96 deletions Students/src/features/undergrad_students/sat scores/satScore.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "../../../apiSlice/satSlice";
import useAuth from "../../../hooks/useAuth";
import NoContent from "../../../components/indications/noContent";
import SatScoreComponent from '../../../components/scores/SatScore'
import SatScoreComponent from "../../../components/scores/SatScore";
function SatScore() {
const student = useAuth();
const {
Expand All @@ -23,16 +23,16 @@ function SatScore() {
isError: satError,
error: satMessage,
} = useGetBySatUserQuery(student.id);
const [addTestScore, {isLoading, isSuccess, isError, error}] = useAddNewSatMutation()
const [addTestScore, { isLoading, isSuccess, isError, error }] =
useAddNewSatMutation();
const [readyToAddSat, setReadyToAddSat] = useState(false);
const [totalScore, setTotalScore] = useState('');
const [mathScore, setMathScore] = useState('');
const [englishScore, setEnglishScore] = useState('');
const [dateTaken, setDateTaken] = useState('');
const [state, setState] = useState('');
const [totalScore, setTotalScore] = useState("");
const [mathScore, setMathScore] = useState("");
const [englishScore, setEnglishScore] = useState("");
const [dateTaken, setDateTaken] = useState("");
const [state, setState] = useState("");


console.log(sats)
console.log(sats);

let content;
const loading = loadSat || isLoading;
Expand All @@ -44,11 +44,11 @@ console.log(sats)
date: dateTaken,
state: state,
totalScore: totalScore,
reading:englishScore,
reading: englishScore,
math: mathScore,
})
if(res.data.isSuccess){
setReadyToAddSat(false)
});
if (res.data.isSuccess) {
setReadyToAddSat(false);
toast.success(`You have successfully added a test score`, {
position: "bottom-right",
autoClose: 5000,
Expand All @@ -59,7 +59,7 @@ console.log(sats)
progress: undefined,
theme: "colored",
});
}else if(res.error){
} else if (res.error) {
toast.error(`${res.error.message}`, {
position: "bottom-right",
autoClose: 5000,
Expand All @@ -70,7 +70,7 @@ console.log(sats)
progress: undefined,
theme: "colored",
});
}else{
} else {
toast.error("Error occured! Try again", {
position: "bottom-right",
autoClose: 5000,
Expand All @@ -83,7 +83,7 @@ console.log(sats)
});
}
} catch (error) {
toast.error("Error occured! Try again", {
toast.error("Error occured! Try again", {
position: "bottom-right",
autoClose: 5000,
hideProgressBar: false,
Expand All @@ -96,40 +96,37 @@ console.log(sats)
}
}

if(!sats?.length){
content = (
<NoContent message='No Sat Test score' />
)
}
if (!sats?.length) {
content = <NoContent message="No Sat Test score" />;
}

if(sats?.length){
content = sats.map(sat=>{
return (
<SatScoreComponent
date={sat.date}
state={sat.state}
totalScore={sat.totalScore}
EVBRW={sat.reading}
Math={sat.math}
/>
)
})
}
if (sats?.length) {
content = sats.map((sat) => {
return (
<SatScoreComponent
date={sat.date}
state={sat.state}
totalScore={sat.totalScore}
EVBRW={sat.reading}
Math={sat.math}
/>
);
});
}

return (
<>
<Page>
<div className="py-1 w-full flex flex-row justify-center fixed bottom-3 left-0">
<button
className="py-2 self-center px-4 bg-MdBlue rounded-xl text-white font-bold"
onClick={()=>setReadyToAddSat(true)}
onClick={() => setReadyToAddSat(true)}
>
Add Sat Test Score
</button>
</div>

{content}

{content}
</Page>
<ToastContainer />
{loading && (
Expand All @@ -140,74 +137,73 @@ Math={sat.math}
{readyToAddSat && (
<ModalBox modalHeader="SAT test score">
<ModalBody>
<label htmlFor="totalScore" className="font-bold">Total SAT score</label>
<label htmlFor="totalScore" className="font-bold">
Total SAT score
</label>
<input
type="text"
id='totalScore'
id="totalScore"
onChange={(e) => setTotalScore(e.target.value)}
placeholder="1600"
className="rounded-md w-80"
required
/>
<div className="flex flex-row">

<label htmlFor="mathScore" className="font-bold">Math score

<input
type="text"
id='mathScore'
onChange={(e) => setMathScore(e.target.value)}
placeholder="800"
className="rounded-md w-20"
required
/>
</label>
<label htmlFor="engScore" className="font-bold">Reading /W score

<input
type="text"
id='mathScore'
onChange={(e) => setEnglishScore(e.target.value)}
placeholder="800"
className="rounded-md w-20"
required
/>
<label htmlFor="mathScore" className="font-bold">
Math score
<input
type="text"
id="mathScore"
onChange={(e) => setMathScore(e.target.value)}
placeholder="800"
className="rounded-md w-20"
required
/>
</label>
<label htmlFor="engScore" className="font-bold">
Reading /W score
<input
type="text"
id="mathScore"
onChange={(e) => setEnglishScore(e.target.value)}
placeholder="800"
className="rounded-md w-20"
required
/>
</label>

</div>
<label htmlFor="engScore" className="font-bold mt-5">Date Taken

<input
type="date"
id='engScore'
onChange={(e) => setDateTaken(e.target.value)}
placeholder="800"
className="rounded-md w-40 mx-3"
required
/>
</label>
<label
for="fileTag"
className="block mb-2 mt-10 self-center md:w-8/12 text-sm font-medium text-gray-900 dark:text-white"
>
* I took the test score from?
</label>
<select
id="fileTag"
className="bg-gray-50 self-center md:w-8/12 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
onChange={(e) => setState(e.target.value)}
>
<option selected value="">
Select an option
</option>
<option value="Official" selected={state == "Official"}>
Official Test Score
</option>
<option value="trial" selected={state == "trial"}>
Bootcamp Trial Test score
</option>

</select>
<label htmlFor="engScore" className="font-bold mt-5">
Date Taken
<input
type="date"
id="engScore"
onChange={(e) => setDateTaken(e.target.value)}
placeholder="800"
className="rounded-md w-40 mx-3"
required
/>
</label>
<label
for="fileTag"
className="block mb-2 mt-10 self-center md:w-8/12 text-sm font-medium text-gray-900 dark:text-white"
>
* I took the test score from?
</label>
<select
id="fileTag"
className="bg-gray-50 self-center md:w-8/12 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
onChange={(e) => setState(e.target.value)}
>
<option selected value="">
Select an option
</option>
<option value="Official" selected={state == "Official"}>
Official Test Score
</option>
<option value="trial" selected={state == "trial"}>
Bootcamp Trial Test score
</option>
</select>
</ModalBody>
<ModalFooter class="py-2 justify-end px-4">
<button
Expand All @@ -220,7 +216,14 @@ Math={sat.math}
<button
className="py-2 px-3 bg-emerald-700 font-bold text-white rounded-md disabled:bg-gray-400 disabled:cursor-not-allowed"
onClick={addSat}
disabled={!totalScore || loading || !mathScore || !englishScore || !dateTaken || !state}
disabled={
!totalScore ||
loading ||
!mathScore ||
!englishScore ||
!dateTaken ||
!state
}
>
{!loading ? "Add test score" : "Adding score..."}
</button>
Expand Down
2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"tailwindcss": "^3.3.1",
"vite": "^4.2.0"
},
"proxy": "http://localhost:5000"
"proxy": "https://ckodon-api-backend.onrender.com"
}
Loading