|
@@ -28,7 +28,7 @@ namespace TEAMModelOS.SDK.Services
|
|
/// <param name="pid"></param>
|
|
/// <param name="pid"></param>
|
|
/// <param name="newNodes"></param>
|
|
/// <param name="newNodes"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public async static Task<(List<List<IdCode>> idCodes, List<SyllabusTreeNode> tree)> ImportSyllabus(List<List<string>> nodes,string volumeId,string scope ,string code,string creatorId ,string creatorName, AzureCosmosFactory azureCosmos, bool ignoreCharacter = true) {
|
|
|
|
|
|
+ public async static Task<(List<List<IdCode>> idCodes, List<SyllabusTreeNode> tree)> ImportSyllabus(List<List<string>> nodes,string volumeId,string scope ,string code,string creatorId ,string creatorName,string grant_type, AzureCosmosFactory azureCosmos, bool ignoreCharacter = true) {
|
|
HashSet<Syllabus> syllabuses= new HashSet<Syllabus>();
|
|
HashSet<Syllabus> syllabuses= new HashSet<Syllabus>();
|
|
string tbname = scope.Equals("school", StringComparison.OrdinalIgnoreCase) ? Constant.School : Constant.Teacher;
|
|
string tbname = scope.Equals("school", StringComparison.OrdinalIgnoreCase) ? Constant.School : Constant.Teacher;
|
|
await foreach (var item in azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).GetItemQueryIterator<Syllabus>(queryText: $"select value(c) from c where c.volumeId='{volumeId}'",
|
|
await foreach (var item in azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).GetItemQueryIterator<Syllabus>(queryText: $"select value(c) from c where c.volumeId='{volumeId}'",
|
|
@@ -142,7 +142,9 @@ namespace TEAMModelOS.SDK.Services
|
|
volume.syllabusIds.Add(chapter.id);
|
|
volume.syllabusIds.Add(chapter.id);
|
|
volumeChange = true;
|
|
volumeChange = true;
|
|
}
|
|
}
|
|
- await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).UpsertItemAsync(chapter);
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(grant_type) && grant_type.Equals("upsert")) {
|
|
|
|
+ await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).UpsertItemAsync(chapter);
|
|
|
|
+ }
|
|
List<SyllabusTree> trees = SyllabusService.ListToTree(chapter.children);
|
|
List<SyllabusTree> trees = SyllabusService.ListToTree(chapter.children);
|
|
SyllabusTreeNode tree = new SyllabusTreeNode() { id = chapter.id, scope = chapter.scope, trees = trees, volumeId = chapter.volumeId, auth = chapter.auth, codeval = code };
|
|
SyllabusTreeNode tree = new SyllabusTreeNode() { id = chapter.id, scope = chapter.scope, trees = trees, volumeId = chapter.volumeId, auth = chapter.auth, codeval = code };
|
|
treeNodes.Add(tree);
|
|
treeNodes.Add(tree);
|