Skip to content

Commit 16938f1

Browse files
committed
Fix handling of 'registration' in State API
* Fixes existing test which was failing on now conformant LRS * Make 'registration' nullable in StateDocument * Add setting registration value in query params and properties for certain State requests which should have already had it
1 parent 008d1d6 commit 16938f1

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

TinCan/Documents/StateDocument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public class StateDocument : Document
2121
{
2222
public Activity activity { get; set; }
2323
public Agent agent { get; set; }
24-
public Guid registration { get; set; }
24+
public Nullable<Guid> registration { get; set; }
2525
}
2626
}

TinCan/RemoteLRS.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ public StateLRSResponse RetrieveState(String id, Activity activity, Agent agent,
552552
state.activity = activity;
553553
state.agent = agent;
554554

555+
if (registration != null)
556+
{
557+
queryParams.Add("registration", registration.ToString());
558+
state.registration = registration;
559+
}
560+
555561
var resp = GetDocument("activities/state", queryParams, state);
556562
if (resp.status != HttpStatusCode.OK && resp.status != HttpStatusCode.NotFound)
557563
{
@@ -570,6 +576,10 @@ public LRSResponse SaveState(StateDocument state)
570576
queryParams.Add("stateId", state.id);
571577
queryParams.Add("activityId", state.activity.id.ToString());
572578
queryParams.Add("agent", state.agent.ToJSON(version));
579+
if (state.registration != null)
580+
{
581+
queryParams.Add("registration", state.registration.ToString());
582+
}
573583

574584
return SaveDocument("activities/state", queryParams, state);
575585
}

0 commit comments

Comments
 (0)