Skip to content
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

Add gradesReleased to LtiLineItem #106

Merged

Conversation

JonathanGawrych
Copy link

Summary of Changes

"gradesReleased" is a new feature of the Assignment and Grade Services 2.0 as of January 24th, 2023. This just adds the property to the line item model so that it may be retreived/set

Testing

  • I have added automated tests for my changes
  • I ran composer test before opening this PR
  • I ran composer lint-fix before opening this PR

return $this->grades_released;
}

public function setGradesReleased($value)
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to add typing to this variable? I looked at the spec, and it doesn't offer any indication as to what type(s) are allowed here. Is this a boolean, string, timestamp, black hole, something else?

Edit: I found some examples in the spec doc, and it looks like they're using bools.

Suggested change
public function setGradesReleased($value)
public function setGradesReleased(bool $value)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Its not called out in the spec, but the examples on the ags spec show it as a boolean. It would have to be parsed as such by us here. @JonathanGawrych is with me at GoReact and we noticed the gradesReleased property was added this january to the spec, so we'd like to just get ahead of that and build in support now.

Copy link
Author

Choose a reason for hiding this comment

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

I was following the pattern of the other properties, not adding type information. Indeed the tests even pass the string 'expected' to every property, even numbers like getScoreMaximium. I added it without types because I wasn't sure which version of php was supported. It's not in the composer.json

I think it would be good if we did a seperate MR to add typing information, what do you think?. I see the tests are running 7.4. Something like activityProgress would be good as a string enum, as the only values are Initialized, Started, InProgress, Submitted, or Completed. Are there any plans to move to PHP >=8.1?

Copy link
Member

@dbhynds dbhynds Oct 6, 2023

Choose a reason for hiding this comment

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

Yeah, I've got some work to do first, but my goal is to set the minimum to >=8.1 and strictly type the entire package (to the extent that the LTI spec allows, at least). Either way, let's type this. I want to default to typing all new functions.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the delay. I've added typing information. Thanks!

return $this->grades_released;
}

public function setGradesReleased(?bool $value): static
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function setGradesReleased(?bool $value): static
public function setGradesReleased(?bool $value): self

PHP 7.4 strikes again!

Copy link
Author

Choose a reason for hiding this comment

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

Ah! I pushed an update to fix this.

@dbhynds dbhynds merged commit 65855b0 into packbackbooks:master Oct 19, 2023
3 checks passed
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