Skip to content

feature: add events module#12

Open
Ishaan-11 wants to merge 8 commits intostudy-abacus:masterfrom
Ishaan-11:feature/add-events-module
Open

feature: add events module#12
Ishaan-11 wants to merge 8 commits intostudy-abacus:masterfrom
Ishaan-11:feature/add-events-module

Conversation

@Ishaan-11
Copy link
Contributor

No description provided.

const { examinationIds, eventId } = this.request.body;

const order = await _ordersService.createOrder(examinationIds, this.request.user.id);
const order = await _ordersService.createOrder({
Copy link
Contributor

Choose a reason for hiding this comment

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

Would need to check if event has expired or not based on endDate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has been already taken care inside api/services/orders/index.js

);
const event = await DB.events.findByPk(eventId);

const amount = event.primaryPrice * 100 + event.secondaryPrice * 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

amount = primaryPrice + ((numOfExams-1) * secondaryPrice)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why do we want to numOfExams-1?
because student can choose only 1 exam as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

First exam would be primary price rest would be secondary

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically

  1. If student purchases 1 exam, amount = primary price
  2. purchases 2 exams, amount = primary + secondary
  3. purchases 3 exams, amount = primary + (2 * secondary)

@Ishaan-11 Ishaan-11 marked this pull request as ready for review August 14, 2023 09:14
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.

2 participants