-
Notifications
You must be signed in to change notification settings - Fork 60
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
Feat: Question Bank, Exam Questions Randomization #21
base: main
Are you sure you want to change the base?
Conversation
Pushing onto the stack |
@devsargam Is it reviewed ? I checked there was a bug while creating a new exam, I fixed that as well. |
@Ardent10 yeah. I will pull the latest and hopefully review it by today. :cheers |
@devsargam @hkirat is it reviewed? Do let me know if this is fine or needs changes. |
b23553f
to
fb040bf
Compare
@devsargam reviewed? |
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.
Code is very clearn. But the actions are concerning me. I might be wrong here but are we checking for global authentication for all of the server actions?
prisma/schema.prisma
Outdated
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.
Share prisma migrations as well
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.
Added
} | ||
|
||
export const createExam = cache(async (examData: CreateExamInput) => { | ||
try { |
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.
Can u add authentication to all the actions
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.
Done
}) | ||
|
||
export const updateExam = cache(async (examData: UpdateExamInput) => { | ||
try { |
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.
same as above
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.
Added auth.
|
||
export const getExams = async () => { | ||
try { | ||
const response = await db.exam.findMany({ |
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.
Check logic if user can see exam without login we can ignore this else add auth
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.
It is a protected route currently which makes more sense, reason being when a user without login redirected to the available exams page (which is a dashboard), it contains all user details, exams taken and everything else on its sidebar.
If a user is NOT LOGGED IN CURRENTLY and they are to take an exam they should pick the exam and then click on the "Pay & Take" test afterwards he is supposed to be redirected to -> login page -> dashboard -> available exams -> select exams that they wish to attempt -> Pay -> Take test. Which is most likely a not an ideal UX for an exam portal.
|
||
// Get Random Questions for an Exam | ||
export const getRandomQuestionsForExam = async (examId: string) => { | ||
try { |
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.
same
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.
Added auth.
// Get Exam Data - Fetch exam details and random questions | ||
export async function getExamData(examId: string) { | ||
try { | ||
const exam = await db.exam.findUnique({ |
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.
same as above
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.
Added auth.
} from '@/schemas' | ||
|
||
export const createQuestions = async (values: createQuestionsValues) => { | ||
try { |
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.
Auth here
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.
Added
src/components/exams/avaiable.tsx
Outdated
@@ -1,11 +1,21 @@ | |||
// components/AvailableExams.tsx |
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.
rm this comment
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.
Done
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.
Check for auth in actions
@Ardent10 update |
@devsargam Updated, Review required. |
@devsargam reviewed? |
Demo: https://www.loom.com/share/07fb4db156744b0b8b29e49a0b21fb84?sid=31a9409b-3ddc-4ad9-99e2-9d39985ff899
Features:
Questions Bank:
Exams
Exam Questions Randomization based on the no of questions being set for that exam.
Global Store with Exam, User and Question slices.
Logo for the application
Reusable Components and code structure.