Skip to content

Session 2 Editorial#105

Open
abhishekkumar2718 wants to merge 2 commits intoIRIS-NITK:mainfrom
abhishekkumar2718:session_2_editorial
Open

Session 2 Editorial#105
abhishekkumar2718 wants to merge 2 commits intoIRIS-NITK:mainfrom
abhishekkumar2718:session_2_editorial

Conversation

@abhishekkumar2718
Copy link
Member

@abhishekkumar2718 abhishekkumar2718 commented Jan 25, 2021

The second session was more straightforward than the first two, as it built directly upon the concepts explained.

t.string :name
t.string :roll_number
t.string :branch
t.decimal :cgpa, precision: 4, scale: 2
Copy link
Member Author

Choose a reason for hiding this comment

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

Precision - Number of digits.
Scale - Number of digits after the decimal point.

Since CGPA has two digits after the decimal point and lies between 0 and 10, it will have scale of 2 and precison of 4.

But precision of 4 implies that 12.34 is valid CGPA, after it has 4 digits (precision) and 2 digits after decimal (scale).

Therefore, I have added a validation in app/models/student.rb to limit CGPA between 0 and 10.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant