Skip to content

Commit a0f5997

Browse files
authored
Merge pull request #23 from GenghisZahn/master
Allow Groups in Context.cs
2 parents ef01bbc + d4a1b9c commit a0f5997

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

TinCan/Context.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,25 @@ public Context(JObject jobj)
4343
}
4444
if (jobj["instructor"] != null)
4545
{
46-
// TODO: can be Group?
47-
instructor = (Agent)jobj.Value<JObject>("instructor");
46+
if (jobj["instructor"]["objectType"] != null && (String)jobj["instructor"]["objectType"] == Group.OBJECT_TYPE)
47+
{
48+
instructor = (Group)jobj.Value<JObject>("instructor");
49+
}
50+
else
51+
{
52+
instructor = (Agent)jobj.Value<JObject>("instructor");
53+
}
4854
}
4955
if (jobj["team"] != null)
5056
{
51-
// TODO: can be Group?
52-
team = (Agent)jobj.Value<JObject>("team");
57+
if (jobj["team"]["objectType"] != null && (String)jobj["team"]["objectType"] == Group.OBJECT_TYPE)
58+
{
59+
team = (Group)jobj.Value<JObject>("team");
60+
}
61+
else
62+
{
63+
team = (Agent)jobj.Value<JObject>("team");
64+
}
5365
}
5466
if (jobj["contextActivities"] != null)
5567
{

0 commit comments

Comments
 (0)