Skip to content

Feat: Question Bank, Exam Questions Randomization#21

Open
Ardent10 wants to merge 7 commits intocode100x:mainfrom
Ardent10:feat/question-bank
Open

Feat: Question Bank, Exam Questions Randomization#21
Ardent10 wants to merge 7 commits intocode100x:mainfrom
Ardent10:feat/question-bank

Conversation

@Ardent10
Copy link
Copy Markdown

@Ardent10 Ardent10 commented Sep 1, 2024

Demo: https://www.loom.com/share/07fb4db156744b0b8b29e49a0b21fb84?sid=31a9409b-3ddc-4ad9-99e2-9d39985ff899

Features:

  1. Questions Bank:

    • Create New Questions (One or Multiple)
    • Update Existing Questions (One or Multiple)
    • Added Image support to a question.
  2. Exams

    • Create new exams
    • update existing exams
    • Soft delete existing exams (isDeleted flag in DB)
  3. Exam Questions Randomization based on the no of questions being set for that exam.

  4. Global Store with Exam, User and Question slices.

  5. Logo for the application

  6. Reusable Components and code structure.

@hkirat
Copy link
Copy Markdown
Contributor

hkirat commented Sep 1, 2024

@devsargam

@devsargam
Copy link
Copy Markdown

Pushing onto the stack

@Ardent10
Copy link
Copy Markdown
Author

Ardent10 commented Sep 6, 2024

@devsargam Is it reviewed ? I checked there was a bug while creating a new exam, I fixed that as well.
You can take a fresh pull.

@devsargam
Copy link
Copy Markdown

@Ardent10 yeah. I will pull the latest and hopefully review it by today. :cheers

@Ardent10
Copy link
Copy Markdown
Author

Ardent10 commented Sep 13, 2024

@devsargam @hkirat is it reviewed? Do let me know if this is fine or needs changes.

@hkirat
Copy link
Copy Markdown
Contributor

hkirat commented Sep 15, 2024

@devsargam

@Ardent10
Copy link
Copy Markdown
Author

@devsargam reviewed?

Copy link
Copy Markdown

@devsargam devsargam left a 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?

Comment thread prisma/schema.prisma
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment thread src/actions/exams.ts
}

export const createExam = cache(async (examData: CreateExamInput) => {
try {
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread src/actions/exams.ts
})

export const updateExam = cache(async (examData: UpdateExamInput) => {
try {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added auth.

Comment thread src/actions/exams.ts

export const getExams = async () => {
try {
const response = await db.exam.findMany({
Copy link
Copy Markdown

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

Copy link
Copy Markdown
Author

@Ardent10 Ardent10 Sep 21, 2024

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.

Comment thread src/actions/exams.ts

// Get Random Questions for an Exam
export const getRandomQuestionsForExam = async (examId: string) => {
try {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added auth.

Comment thread src/actions/exams.ts
// Get Exam Data - Fetch exam details and random questions
export async function getExamData(examId: string) {
try {
const exam = await db.exam.findUnique({
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added auth.

Comment thread src/actions/questions.ts
} from '@/schemas'

export const createQuestions = async (values: createQuestionsValues) => {
try {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment thread src/components/exams/avaiable.tsx Outdated
@@ -1,11 +1,21 @@
// components/AvailableExams.tsx
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm this comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown

@devsargam devsargam left a 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

@devsargam
Copy link
Copy Markdown

@Ardent10 update

@Ardent10
Copy link
Copy Markdown
Author

@devsargam Updated, Review required.

@Ardent10
Copy link
Copy Markdown
Author

Ardent10 commented Oct 2, 2024

@devsargam reviewed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants