|
@@ -1,5 +1,4 @@
|
|
|
using Azure.Cosmos;
|
|
|
-using DocumentFormat.OpenXml.Bibliography;
|
|
|
using DocumentFormat.OpenXml.ExtendedProperties;
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|
@@ -35,6 +34,8 @@ namespace TEAMModelOS.SDK.Services
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Syllabus-{code}") })) {
|
|
|
syllabuses.Add(item);
|
|
|
}
|
|
|
+ Volume volume = await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<Volume>($"{volumeId}", new PartitionKey($"Volume-{code}"));
|
|
|
+
|
|
|
HashSet<Syllabus> chapters = new HashSet<Syllabus>();
|
|
|
long now= DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
List<List<IdCode> > resNodes = new List<List<IdCode>>();
|
|
@@ -132,11 +133,18 @@ namespace TEAMModelOS.SDK.Services
|
|
|
resNodes.Add(nodesVal.Select(z => new IdCode { id = z.id, code = z.title }).ToList());
|
|
|
}
|
|
|
}
|
|
|
- foreach(var chapter in chapters)
|
|
|
+ bool volumeChange=false;
|
|
|
+ foreach (var chapter in chapters)
|
|
|
{
|
|
|
+ if (!volume.syllabusIds.Contains(chapter.id)) {
|
|
|
+ volume.syllabusIds.Add(chapter.id);
|
|
|
+ volumeChange = true;
|
|
|
+ }
|
|
|
await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).UpsertItemAsync(chapter);
|
|
|
}
|
|
|
-
|
|
|
+ if (volumeChange) {
|
|
|
+ await azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync(volume,volume.id,new PartitionKey(volume.code));
|
|
|
+ }
|
|
|
return (resNodes,chapters);
|
|
|
}
|
|
|
|