-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Tests and transform statements #16
Tests and transform statements #16
Conversation
Thanks for putting so much of your time into this PR - I can see you have been super busy! I am finding it quite difficult to review this PR, it seems to be tackling lots of different issues and its not easy to differentiate all the changes that are happening. From what I can see you have:
You've also raised some valid points about having another convenience function, async and line lengths. In order for me to review these changes, would it be possible for you to split up the PR into multiple PRs that each tackle an individual issue? The less line changes the better, ideally only changing lines where new additions have been made rather than reformatting whole files. (Except where prettier rules are introduced in a prettier PR which is designed to reformat files) Also with the points raised in your NOTES/QUESTIONS above, they would be better suited either in the separate PRs as discussion points relating to the code changes you are making (async, line lengths) or in new issues (convenience function). I do love where these changes are heading, if we can establish some tougher lint rules it should help other people contribute in the future! |
sure. What if I just broke out prettier and did that first? It's much easier to collaborate on code with deterministic formatting cos avoids the thing where everyone's code editor will overwrite each other's files, etc. |
prettier PR is here: #17 |
Thanks for the prettier PR, it looks great and I'll be sure to try and bring some consistency into the other @xapi/* projects with this in the future. Unfortunately this PR's diff hasn't updated with the new changes meaning its hard to see the new amends. Could you edit this PR to merge into a different branch and then back to master to trigger a diff refresh? Or alternatively open up a new PR with these same changes? |
yeah, i will rebase it
…On Wed, Oct 7, 2020 at 1:18 PM Christian Cook ***@***.***> wrote:
Thanks for the prettier PR, it looks great and I'll be sure to try and
bring some consistency into the other @xapi/* projects with this in the
future.
Unfortunately this PR's diff hasn't updated with the new changes meaning
its hard to see the new amends. Could you edit this PR to merge into a
different branch and then back to master to trigger a diff refresh? Or
alternatively open up a new PR with these same changes?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPCPOFEHXC57M4CEBAKULSJTEJPANCNFSM4SFLC4DA>
.
|
feature: adds type check feature: test coverage for initialize sequence feature: isCmiAvailable checks if cmi5 launch params are present feature: test coverage for initialize sequence - throws on auth fail - throws on getLaunchData fail - swallows errors on getLearnerPrefs failed - throws on post INITIALIZED statement fails feature: Cmi5.complete applies optional statement transform when provided feature: Cmi5.pass applies optional statement transform when provided feature: Cmi5.pass applies optional statement transform when provided feature: Cmi5.fail posts a FAILED statement with a result score passed as a number feature: Cmi5.fail applies optional statement transform when provided improvement: test constructor parses launch params from window.location improvement: test cmi5 complete statement improvement: tests Cmi5.complete throws if launch mode not 'Normal' improvement: tests Cmi5.complete sends duration as time since initialized improvement: tests Cmi5.pass posts a PASSED statement with a result score improvement: tests Cmi5.pass posts a PASSED statement with a result score passed as a number improvement: tests Cmi5.pass posts a PASSED statement with no result score when score not passed improvement: test Cmi5.pass throws if passed score is beneath masteryScore improvement: test throws exception if PASSED invalid for launch mode improvement: test Cmi5.pass assigns an ObjectiveActivity when passed as second param improvement: test Cmi5.pass sends duration as time since initialized improvement: Cmi5.fail posts a FAILED statement with a result score improvement: test Cmi5.fail posts a FAILED statement with no result score when score not passed improvement: test tCmi5.fail wqhrows exception if FAILED invalid for launch mode improvement: test sCmi5.fail wqends duration as time since initialized improvement: test Cmi5.terminate posts a TERMINATED statement improvement: test sCmi5.terminate sends duration as time since initialized
@CookieCookson did anything change with config relating to github actions? github test action is failing to checkout the project at all with a weird errors:
...use circleci pretty much everywhere else, so not a ton of experience with github actions. Googling seems to say that this might be github-downtime issue, but skeptical about that. Maybe it's something about my action config? |
tried reopen as a new branch/pr and same problem...anything change in terms of settings that might make checkout fail? |
i think the checkout fails were related to changes coming from my forked branch and then it wants to run an action in your repo (although that seemed to work ok w the prettier branch?) Not sure yet what the correct way to set this up is. But last change I made got it working. |
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 really great! Just a few minor tweaks required and we can get this merged in 👍
src/Cmi5.ts
Outdated
score?: ResultScore, | ||
objective?: ObjectiveActivity | ||
score?: ResultScore | number, | ||
objectiveOrOptions?: ObjectiveActivity | SendStatementOptions |
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.
Why is this like this? Should they not be separate parameters?
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.
number 1 reason is backwards compatibility, and I'm assuming from the existing signature that you consider adding an objective activity common enough to make it a default param.
The thing I was trying to avoid was having a positional arg that callers would need to set null in order to use options, e.g.
cmi.pass(0.9, null, { transform: (s) => ...}
...on the other hand, you want to make it easy to do maybe a transform and add the objective activity, so what do you think of just making objectiveActivity
another property in options (last commit)?
So this way callers can do:
// pass just a plain objective activity (backwards compatible)
cmi.pass(0.9, {
objectType: "Activity",
id: "http://example.com/object/12345",
definition: { type: "http://adlnet.gov/expapi/activities/objective" },
})
// pass an a objective activity as an option
cmi.pass(0.9,
{
objectiveActivity: {
objectType: "Activity",
id: "http://example.com/object/12345",
definition: { type: "http://adlnet.gov/expapi/activities/objective" },
},
tranform: (s) => {...s}
})
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.
Currently, backwards compatibility is not top of the priorities list. As its still in pre-release, I want to make sure we get the structure of the signatures right before announcing a v1.0.0. I am possibly thinking that the first param should always be an object... I will take a look through the other methods and see if I can think of something that is future proof and user friendly.
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.
As I haven't had enough experience in using cmi5 in real life applications, I'm not certain how often one would need to add an objective activity. Everything that has been implemented has been based off of requirements in the cmi5 specification, and not from experience using cmi5 in the wild.
I suppose if both the objective activity and a custom transform is required, the objective activity could be added in the transformation?
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.
Yes, at the limit, can do anything/everything with the transform, but as a convenience, I also put objectiveActivity
as another property of options. In future could put other common things that just get copied somewhere in the statement as properties in the options object e.g. resultExtensions
and contextExtensions
great. making those changes now. About merging: I noticed last PR got merged with all the branch commits intact, which I know is the default github option, but do you prefer it to 'SQUASH MERGE'? For most repos I work on, we prefer the squash for PRs and then disable all the other options in settings |
Good shout, I completely missed that. I've configured all the repos to accept squash merges only now. |
Great job! I will merge in the changes into master, and get the updates to the docs drafted before doing a release (v0.2.0). |
This is still a draft but enough here that it's worth getting some feedback.
PR adds basic test coverage adds the feature to pass an optional
transform(s:Statement): Statement
function withcomplete
,pass
, andfail
TODO:
NOTES/QUESTIONS:
any objection to a convenience function like
moveOn
that sends in sequenceCOMPLETED
,PASSED
|FAILED
(depending on score), and optionallyTERMINATED
?any objection to using async instead of
Promise.then
?I added prettier and tried to make it conform as much as possible to the style already in place to avoid file reformats. Any objection to reducing the line length down to 80 though?