Skip to content

Commit

Permalink
#27 - Account for logical/semantic notion of goal achievement. Tested
Browse files Browse the repository at this point in the history
successfully with Verifier.
  • Loading branch information
John Wolfe committed Jul 15, 2014
1 parent 6de35ab commit 89d2911
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ INSERT INTO DIM_ND
120.000000,
"d8677561-de3d-426c-bcce-92e25ff4e087");
INSERT INTO DIM_GE
VALUES (2052.000000,
1344.000000,
VALUES (2244.000000,
1392.000000,
"d8677561-de3d-426c-bcce-92e25ff4e087",
"00000000-0000-0000-0000-000000000000");
INSERT INTO DIM_ELE
Expand Down Expand Up @@ -776,18 +776,18 @@ INSERT INTO SPR_RS
VALUES ("e38e0ea8-25a0-41da-a405-23297abac860",
'newGoalSpec',
'',
'// Create a new goal specification and relate it to the
// singleton instance of workout session if it exists.
select any session from instances of WorkoutSession;
if ( not empty session )
create object instance goalSpec of GoalSpec;
goalSpec.sequenceNumber = param.sequenceNumber;
goalSpec.minimum = param.minimum;
goalSpec.maximum = param.maximum;
goalSpec.span = param.span;
goalSpec.criteriaType = param.criteriaType;
goalSpec.spanType = param.spanType;
relate goalSpec to session across R10.''included in'';
'// Create a new goal specification and relate it to the
// singleton instance of workout session if it exists.
select any session from instances of WorkoutSession;
if ( not empty session )
create object instance goalSpec of GoalSpec;
goalSpec.sequenceNumber = param.sequenceNumber;
goalSpec.minimum = param.minimum;
goalSpec.maximum = param.maximum;
goalSpec.span = param.span;
goalSpec.criteriaType = param.criteriaType;
goalSpec.spanType = param.spanType;
relate goalSpec to session across R10.''included in'';
end if;',
1);
INSERT INTO C_EP_PROXY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,28 @@ INSERT INTO O_TFR
'',
"0c2280ac-677d-4cc7-a34f-fde18b6c9506",
0,
'// Return the indicator value representing the disposition of
// the currently executing goal, if one exists. If there is
// no currently executing goal, return Flat.

// Find the currently executing goal (if one exists) associated
// with the singleton instance of the workout session.
select any session from instances of WorkoutSession;
select one goal related by session->Goal[R11.''is currently executing''];

// Convert the disposition of the currently executing goal
// (if it exists) to a UI indicator.
indicator = Indicator::Flat;
if ( not empty goal )
if ( goal.disposition == GoalDisposition::Increase )
indicator = Indicator::Up;
elif ( goal.disposition == GoalDisposition::Decrease )
indicator = Indicator::Down;
end if;
end if;

'// Return the indicator value representing the disposition of
// the currently executing goal, if one exists. If there is
// no currently executing goal, return Blank.

// Find the currently executing goal (if one exists) associated
// with the singleton instance of the workout session.
select any session from instances of WorkoutSession;
select one goal related by session->Goal[R11.''is currently executing''];

// Convert the disposition of the currently executing goal
// (if it exists) to a UI indicator.
indicator = Indicator::Blank;
if ( not empty goal )
if ( goal.disposition == GoalDisposition::Increase )
indicator = Indicator::Up;
elif ( goal.disposition == GoalDisposition::Decrease )
indicator = Indicator::Down;
else
indicator = Indicator::Flat;
end if;
end if;

return( indicator );',
1,
'',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ if ( currentValue < goalSpec.minimum )
elif ( currentValue > goalSpec.maximum )
goalDisposition = GoalDisposition::Decrease;
end if;

// Invert the disposition value to produce a logical, semantic disposition for
// goal types, such as pace, that require it.
if ( goalSpec.criteriaType == GoalCriteria::Pace )
if ( goalDisposition == GoalDisposition::Increase )
goalDisposition = GoalDisposition::Decrease;
elif ( goalDisposition == GoalDisposition::Decrease )
goalDisposition = GoalDisposition::Increase;
end if;
end if;

return( goalDisposition );',
1,
Expand Down Expand Up @@ -169,21 +179,21 @@ INSERT INTO O_TFR
'',
"ba5eda7a-def5-0000-0000-000000000000",
0,
'// Advance to the next goal or start the first one if one
// is currently not exectuing.
// If there is a goal currently executing, notify it that its execution
// has completed.
// Otherwise, create and start a goal for the first goal specification
// if one exists.
select any session from instances of WorkoutSession; // WorkoutSession is a singleton.
if ( not empty session )
select one goal related by session->Goal[R11.''is currently executing''];
if ( not empty goal )
generate Goal1:Completed to goal;
else
Goal::create( sequenceNumber: GoalSpecOrigin );
end if;
'// Advance to the next goal or start the first one if one
// is currently not exectuing.

// If there is a goal currently executing, notify it that its execution
// has completed.
// Otherwise, create and start a goal for the first goal specification
// if one exists.
select any session from instances of WorkoutSession; // WorkoutSession is a singleton.
if ( not empty session )
select one goal related by session->Goal[R11.''is currently executing''];
if ( not empty goal )
generate Goal1:Completed to goal;
else
Goal::create( sequenceNumber: GoalSpecOrigin );
end if;
end if;',
1,
'',
Expand All @@ -199,7 +209,13 @@ INSERT INTO O_ATTR
"c1022670-c44d-401e-bb23-dfcef6084fba",
"7d60ba72-b691-4687-9636-20d33798168c",
'disposition',
'The disposition of this goal. See data type descriptions for details.',
'The disposition of this goal. See data type descriptions for details.
This attribute represents the logical or semantic disposition of the goal.
For example, a disposition indicating the need to increase the value in question
for a heart-rate goal means that activity should be increased to drive up the
heart rate. Since pace is the inverse of speed, a disposition indicating
the need to increase the value in question (pace) means that the user must
increase speed, causing a lower (faster) pace number.',
'',
'disposition',
0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ INSERT INTO O_OBJ
'GoalSpec',
'Each instance specifies one particular workout goal. The actual execution of the goal
along with evaluation of whether it is currently being achieved is handled by another
class, not this one.',
class, not this one.

The criteria for the goal are merely numerical figures for comparison against the
measured quantity. Accordingly, the terms may create confusion with certain goal
types such as pace. Since pace is the inverse of speed, a lower number represents
a faster speed. Even so, when specifying a pace-related goal the value for
minimum should be the lowest number (fastest pace) and the value for maximum should
be the higher number (slower pace).',
"00000000-0000-0000-0000-000000000000");
INSERT INTO O_NBATTR
VALUES ("a0ebe4b4-e0e7-422f-a981-574f075629d3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,38 @@ INSERT INTO S_SYNC
"00000000-0000-0000-0000-000000000000",
'createGoals-1',
'',
'// Create some goal specifications.
send UI::newGoalSpec(
sequenceNumber: 1,
minimum: 2.0,
maximum: 8.0,
span: 200.0,
criteriaType: GoalCriteria::Pace,
spanType: GoalSpan::Distance );

send UI::newGoalSpec(
sequenceNumber: 2,
minimum: 60.0,
maximum: 80.0,
span: 10,
criteriaType: GoalCriteria::HeartRate,
spanType: GoalSpan::Time );

send UI::newGoalSpec(
sequenceNumber: 3,
minimum: 5.0,
maximum: 6.0,
span: 15,
criteriaType: GoalCriteria::Pace,
spanType: GoalSpan::Time );

'// Create some goal specifications.
send UI::newGoalSpec(
sequenceNumber: 1,
minimum: 2.0,
maximum: 8.0,
span: 200.0,
criteriaType: GoalCriteria::Pace,
spanType: GoalSpan::Distance );

send UI::newGoalSpec(
sequenceNumber: 2,
minimum: 60.0,
maximum: 80.0,
span: 10,
criteriaType: GoalCriteria::HeartRate,
spanType: GoalSpan::Time );

send UI::newGoalSpec(
sequenceNumber: 3,
minimum: 5.0,
maximum: 6.0,
span: 15,
criteriaType: GoalCriteria::Pace,
spanType: GoalSpan::Time );

send UI::newGoalSpec(
sequenceNumber: 4,
minimum: 1.0,
maximum: 2.0,
span: 15,
criteriaType: GoalCriteria::Pace,
spanType: GoalSpan::Time );
',
"ba5eda7a-def5-0000-0000-000000000000",
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ INSERT INTO S_ENUM
'A downward indicator: perhaps an arrow pointing up.',
"0c2280ac-677d-4cc7-a34f-fde18b6c9506",
"5ac9a186-c6db-4585-b9f0-55b33f8f9188");
INSERT INTO S_ENUM
VALUES ("e24ca681-a88f-481f-9a58-563692e6a583",
'Blank',
'No indicator at all.',
"0c2280ac-677d-4cc7-a34f-fde18b6c9506",
"77c1c31d-c558-4feb-8ea1-780d12a75db4");
INSERT INTO PE_PE
VALUES ("0c2280ac-677d-4cc7-a34f-fde18b6c9506",
1,
Expand Down

0 comments on commit 89d2911

Please sign in to comment.