-
Notifications
You must be signed in to change notification settings - Fork 56
Implement XP #232
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
Implement XP #232
Conversation
Pull Request Test Coverage Report for Build 1711
💛 - Coveralls |
|
@ningyuansg will need you to add |
a932e45 to
7b1489d
Compare
|
@remo5000 need your input regarding endpoint to retreive XP |
| reading: :reading, | ||
| status: &(&1.user_status || "not_attempted"), | ||
| maxGrade: :max_grade, | ||
| maxXp: :max_xp, |
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.
Looks good to me
tuesmiddt
left a 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.
Reviewed everything except tests. Some comments so far.
lib/cadet/assessments/assessment.ex
Outdated
| field(:max_grade, :integer, virtual: true) | ||
| field(:max_xp, :integer, virtual: true) | ||
| field(:xp, :integer, virtual: true) | ||
| field(:grade, :integer, virtual: true) |
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 order together(max_grade, grade, max_xp, xp) or (max_grade, max_xp, grade, xp)
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.
Done
lib/cadet/assessments/answer.ex
Outdated
| |> add_question_type_from_model(params) | ||
| |> validate_required(@required_fields) | ||
| |> validate_number(:grade, greater_than_or_equal_to: 0.0) | ||
| |> validate_number(:grade, greater_than_or_equal_to: 0) |
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.
I'm thinking, it might be better to add
|> validate_number(:grade, greater_than_or_equal_to: 0)
|> validate_number(:xp, greater_than_or_equal_to: 0)
to validate_xp_grade_adjustment_total, rename it, and use it in every changeset where grade/xp/adjustments can be set, including autograding_changeset, since we aren't validating the numeric results of autograder there.
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
lib/cadet/assessments/assessments.ex
Outdated
| alias Cadet.Autograder.GradingJob | ||
| alias Ecto.Multi | ||
|
|
||
| @xp_early_submission_bonus 100 |
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.
Maybe rename this to @xp_early_submission_max_bonus for clarity
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
| if grade do | ||
| Decimal.to_integer(grade) | ||
| defp decimal_to_integer(decimal) do | ||
| if Decimal.decimal?(decimal) do |
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.
Something about this tickles me hahahahaha
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.
🙃
| "Only provided for 'Student'" | ||
| ) | ||
|
|
||
| xp(:integer, "Amount of xp. Only provided for 'Student'") |
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.
"Amount of xp. Value will be 0 for non-students" or something along those lines.
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
| status: &(&1.user_status || "not_attempted"), | ||
| maxGrade: :max_grade, | ||
| maxXp: :max_xp, | ||
| xp: &(&1.xp || 0), |
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.
I feel like xp: :xp will suffice since both user_total_grade() and user_total_xp() return default values of 0. Correct me if I'm wrong on this.
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.
Oh you're right.
3a41f82 to
b20ffce
Compare
XP Document
Implied
Implement Endpoint
User, addtotal_xpGrading, addxp,xp_bonus,xp_adjustmentAssessment, addmax_xp,xp,gradeFile issue in other repos
cs1101s