-
Notifications
You must be signed in to change notification settings - Fork 57
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
Consolidating open PRs #40
Merged
reedmclean
merged 6 commits into
RusticiSoftware:master
from
reedmclean:MinorVersionChanges
Sep 13, 2018
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0c7c179
Added tests for Group instructor/team
reedmclean 4c152e3
Added support for xAPI 1.0.3 & default to 1.0.3 for latest version
madmox 92e8b27
Fixed tests for xAPI v1.0.3
reedmclean a8dbf07
ActivityDefinition InteractionType
olivergurnell b8d7829
Conforming with changes requsted after a pull request review. See htt…
peturingi fa0d377
Minor styling, whitespace, and copyright fixes
reedmclean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
Copyright 2018 Rustici Software | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json.Linq; | ||
using TinCan.Json; | ||
|
||
namespace TinCan | ||
{ | ||
public class InteractionComponent : JsonModel | ||
{ | ||
public String id; | ||
public LanguageMap description { get; set; } | ||
|
||
public InteractionComponent() | ||
{ | ||
|
||
} | ||
|
||
public InteractionComponent(JObject jobj) | ||
{ | ||
if (jobj["id"] != null) | ||
{ | ||
id = jobj.Value<String>("id"); | ||
} | ||
if (jobj["description"] != null) | ||
{ | ||
description = (LanguageMap)jobj.Value<JObject>("description"); | ||
} | ||
} | ||
|
||
public override JObject ToJObject(TCAPIVersion version) | ||
{ | ||
JObject result = new JObject(); | ||
|
||
if (id != null) | ||
{ | ||
result.Add("id", id); | ||
} | ||
if (description != null && !description.isEmpty()) | ||
{ | ||
result.Add("description", description.ToJObject(version)); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public static explicit operator InteractionComponent(JObject jobj) | ||
{ | ||
return new InteractionComponent(jobj); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
|
||
namespace TinCan | ||
{ | ||
public sealed class InteractionType | ||
{ | ||
private const string CHOICE = "choice"; | ||
private const string SEQUENCING = "sequencing"; | ||
private const string LIKERT = "likert"; | ||
private const string MATCHING = "matching"; | ||
private const string PERFORMANCE = "performance"; | ||
private const string TRUEFALSE = "true-false"; | ||
private const string FILLIN = "fill-in"; | ||
private const string LONGFILLIN = "long-fill-in"; | ||
private const string NUMERIC = "numeric"; | ||
private const string OTHER = "other"; | ||
|
||
public static readonly InteractionType Choice = new InteractionType(CHOICE); | ||
public static readonly InteractionType Sequencing = new InteractionType(SEQUENCING); | ||
public static readonly InteractionType Likert = new InteractionType(LIKERT); | ||
public static readonly InteractionType Matching = new InteractionType(MATCHING); | ||
public static readonly InteractionType Performance = new InteractionType(PERFORMANCE); | ||
public static readonly InteractionType TrueFalse = new InteractionType(TRUEFALSE); | ||
public static readonly InteractionType FillIn = new InteractionType(FILLIN); | ||
public static readonly InteractionType LongFillIn = new InteractionType(LONGFILLIN); | ||
public static readonly InteractionType Numeric = new InteractionType(NUMERIC); | ||
public static readonly InteractionType Other = new InteractionType(OTHER); | ||
|
||
private InteractionType(string value) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public static InteractionType FromValue(string value) | ||
{ | ||
switch (value) | ||
{ | ||
case CHOICE: | ||
return Choice; | ||
|
||
case SEQUENCING: | ||
return Sequencing; | ||
|
||
case LIKERT: | ||
return Likert; | ||
|
||
case MATCHING: | ||
return Matching; | ||
|
||
case PERFORMANCE: | ||
return Performance; | ||
|
||
case TRUEFALSE: | ||
return TrueFalse; | ||
|
||
case FILLIN: | ||
return FillIn; | ||
|
||
case LONGFILLIN: | ||
return LongFillIn; | ||
|
||
case NUMERIC: | ||
return Numeric; | ||
|
||
case OTHER: | ||
return Other; | ||
|
||
default: | ||
throw new ArgumentOutOfRangeException(nameof(value), | ||
$"'{value}' is not a valid interactionType."); | ||
} | ||
} | ||
|
||
public string Value { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It will probably become a need pretty quickly to allow for individual additions of a single
InteractionComponent
to each of these lists. The public interface of the class requires you to set the whole list. That's been an issue elsewhere in the library in the past. Not something that has to hold up this PR, but it is something to be aware of for the future.