Skip to content

Commit

Permalink
matches bug fix (UI remaining)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashree-17 committed Dec 25, 2023
1 parent 8f65ab2 commit 7062946
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 45 deletions.
34 changes: 7 additions & 27 deletions components/matchedResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,17 @@ import { Matched_Ids, Matches } from '@/utils/UserData';

const Results = () => {

// let Matches: Student[] = []


// useEffect(() => {
// // Fetching Data of the Matched_Ids for Displaying
// const display_result = async() => {
// await get_result();
// for(let j=0; j < Matched_Ids.length; j++) {
// const data: Array<Student> = search_students(Matched_Ids[j]);
// if(!data.length) {
// return;
// }
// const student = data[0];
// Matches.push(student)
// }
// console.log(Matches)
// }
// display_result();
// }, [])

// console.log(Matches)
return (
<div>
{Matches.map((student) => (
<MatchedCard
key={student.i}
student={student}
matched
/>
// <MatchedCard
// key={student.i}
// student={student}
// matched
// />
<div>{student.i}</div>
))}
</div>
</div>
);
};

Expand Down
20 changes: 19 additions & 1 deletion pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import "../app/globals.css";
import GoToTop from '@/components/GoToTop';
import { useRouter } from 'next/router';
import Clear from '@/components/clear';import { SendHeart } from '@/utils/API_Calls/Send_Heart';
import {receiverIds, setUser, user} from '../utils/UserData';
import {Matched_Ids, receiverIds, setMatches, setUser, user} from '../utils/UserData';
import { handle_Logout } from '@/utils/API_Calls/login_api';
import { Id, Submit} from "../utils/UserData"
import Link from 'next/link';
import { search_students,Student } from '@/utils/API_Calls/search';
import { get_result } from '@/utils/API_Calls/get_results';

const SERVER_IP = process.env.SERVER_IP

Expand Down Expand Up @@ -201,6 +202,23 @@ const New = () => {
setShowStud(!isShowStud);
}

useEffect(() => {
const show_result = async() => {
await get_result();
setMatches([])
for(let j=0; j < Matched_Ids.length; j++) {
const data: Array<Student> = search_students(Matched_Ids[j]);
if(!data.length) {
return;
}
const student = data[0];
console.log(student)
setMatches(student)
}
}
show_result();
}, [])

const stylesss = {
backgroundImage: `url("https://home.iitk.ac.in/~${user?.u}/dp"), url("https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/${user?.i}_0.jpg"), url("/dummy.png")`,
};
Expand Down
17 changes: 0 additions & 17 deletions pages/result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@ import { get_result } from "@/utils/API_Calls/get_results";

const ResultPage = () => {

useEffect(() => {
const show_result = async() => {
await get_result();
for(let j=0; j < Matched_Ids.length; j++) {
const data: Array<Student> = search_students(Matched_Ids[j]);
if(!data.length) {
return;
}
const student = data[0];
setMatches(student)
}
}
show_result();
}, [])



const stylesss = {
backgroundImage: `url("https://home.iitk.ac.in/~${user?.u}/dp"), url("https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/${user?.i}_0.jpg"), url("/dummy.png")`,
};
Expand Down

0 comments on commit 7062946

Please sign in to comment.