Port profile api from wip/iob-cob #439

Merged
merged 3 commits into from Mar 8, 2015

Conversation

Projects
None yet
3 participants
Owner

jasoncalabrese commented Feb 26, 2015

This PR is to make it easier to bring some of the work @MilosKozak to the mainline and to prepare for adding and option to enable IOB in the mainline

Jason Calabrese added some commits Sep 25, 2014

@jasoncalabrese Jason Calabrese forgot to git add some profile api files ea1dbcc
@jasoncalabrese Jason Calabrese no POSTs yet 7653ef5
@jasoncalabrese Jason Calabrese more cherry-picking and porting of the profile api/storage from iob-cob
6080f67

Coverage Status

Coverage increased (+0.33%) to 71.15% when pulling 6080f67 on wip/enable-profile into d616b6c on dev.

Owner

jasoncalabrese commented Mar 1, 2015

Need to add IOB tests

@dduugg dduugg commented on the diff Mar 1, 2015

lib/websocket.js
@@ -188,8 +190,19 @@ function update() {
treatment.x = timestamp.getTime();
return treatment;
});
- // all done, do loadData
- loadData( );
+
+ profiles.list(function (err, results) {
+ // There should be only one document in the profile collection with a DIA. If there are multiple, use the last one.
+ results.forEach(function(element, index, array) {
+ if (element) {
+ if (element.dia) {
@dduugg

dduugg Mar 1, 2015

Contributor

Lines 197-198 could be simplified to if (element && element.dia) {, correct?

Also, consider a standard for loop that goes backward from the end of results, and breaks when it finds element.dia.

@dduugg dduugg commented on the diff Mar 1, 2015

lib/websocket.js
@@ -237,6 +250,10 @@ function loadData() {
});
}
+ if (profileData) {
@dduugg

dduugg Mar 1, 2015

Contributor

Is this ever false? (an empty array is truthy).

Owner

jasoncalabrese commented Mar 1, 2015

@dduugg this was a quick port from the iob-cob branch, was planning on doing some cleanup, not sure if that happens here or with #452

@jasoncalabrese jasoncalabrese merged commit 6080f67 into dev Mar 8, 2015

3 checks passed

continuous-integration/codeship Build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jasoncalabrese jasoncalabrese modified the milestone: enchilada Mar 18, 2015

jasoncalabrese changed the title from Page to enter and view a treatment profile to Port profile api from wip/iob-cob Mar 18, 2015

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