|
@@ -777,6 +777,13 @@ namespace TEAMModelOS.Controllers
|
|
|
teacherTrains.Add(item);
|
|
|
}
|
|
|
}
|
|
|
+ string sql = $" select distinct value(b.id ) from c join b in c.children where c.code='AbilityTask-standard10' ";
|
|
|
+ List<string> nodeIdsDB = new List<string>();
|
|
|
+ await foreach (var y in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<string>
|
|
|
+ (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
|
|
|
+ {
|
|
|
+ nodeIdsDB.Add(y);
|
|
|
+ }
|
|
|
List<string> right=new List<string>();
|
|
|
List<string> left=new List<string>();
|
|
|
foreach (var item in teacherTrains)
|
|
@@ -786,34 +793,32 @@ namespace TEAMModelOS.Controllers
|
|
|
TeacherFile teacherFile = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<TeacherFile>(item.id, new PartitionKey($"TeacherFile-{item.code.Replace("TeacherTrain-", "")}"));
|
|
|
var nodeIds= teacherFile.fileRecords.SelectMany(x => x.files).Select(x => x.nodeId).ToHashSet();
|
|
|
bool expect = false;
|
|
|
- if (nodeIds.Any()) {
|
|
|
- string sql = $" select distinct value(b.id ) from c join b in c.children where c.code='AbilityTask-standard10' and b.id in ({string.Join(",",nodeIds.Select(x=>$"'{x}'"))})";
|
|
|
- List<string> nodeIdsDB = new List<string>();
|
|
|
- await foreach (var y in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<string>
|
|
|
- (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
|
|
|
- {
|
|
|
- nodeIdsDB.Add(y);
|
|
|
- }
|
|
|
+ if (nodeIds.Any())
|
|
|
+ {
|
|
|
var exp= nodeIds.Except(nodeIdsDB);
|
|
|
- if (exp.Any()) {
|
|
|
+ if (exp.Any())
|
|
|
+ {
|
|
|
expect = true;
|
|
|
+ List<FileAbility> dels = new List<FileAbility>();
|
|
|
+ teacherFile.fileRecords.ForEach(x => {
|
|
|
+ x.files.RemoveAll(z => exp.Contains(z.nodeId));
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
if (expect)
|
|
|
{
|
|
|
left.Add(item.id);
|
|
|
- /*
|
|
|
foreach (var x in item.currency.teacherAilities)
|
|
|
{
|
|
|
- string sql = $" select value(c) from c where c.abilityId='{x.id}' and c.code='AbilityTask-standard10'";
|
|
|
+ string sqls = $" select value(c) from c where c.abilityId='{x.id}' and c.code='AbilityTask-standard10'";
|
|
|
List<AbilityTask> abilityTasks = new List<AbilityTask>();
|
|
|
Dictionary<string, RecordFileAbility> valuePairs = new Dictionary<string, RecordFileAbility>();
|
|
|
await foreach (var y in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<AbilityTask>
|
|
|
- (sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
|
|
|
+ (sqls, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"AbilityTask-standard10") }))
|
|
|
{
|
|
|
abilityTasks.Add(y);
|
|
|
}
|
|
|
- double limit = 0;
|
|
|
+ // double limit = 0;
|
|
|
abilityTasks.ForEach(x =>
|
|
|
{
|
|
|
x.children.ForEach(y =>
|
|
@@ -824,8 +829,11 @@ namespace TEAMModelOS.Controllers
|
|
|
if (valuePairs.ContainsKey(r.hash))
|
|
|
{
|
|
|
valuePairs.TryGetValue(r.hash, out var value);
|
|
|
- value.fileAbilities.Add(new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = y.id });
|
|
|
- limit = limit + r.duration;
|
|
|
+ var ablt= value.fileAbilities.Find(z => z.abilityId.Equals(x.abilityId) && z.taskId.Equals(x.id) && z.nodeId.Equals(y.id) );
|
|
|
+ if (ablt == null) {
|
|
|
+ value.fileAbilities.Add(new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = y.id });
|
|
|
+ // limit = limit + r.duration;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -835,7 +843,7 @@ namespace TEAMModelOS.Controllers
|
|
|
new FileRecord { hash = r.hash, size = r.size.Value, duration = r.duration, view = (int)r.duration, type = r.type, done = true },
|
|
|
fileAbilities = new List<FileAbility> { new FileAbility { url = r.link, abilityId = x.abilityId, taskId = x.id, nodeId = y.id } }
|
|
|
});
|
|
|
- limit = limit + r.duration;
|
|
|
+ // limit = limit + r.duration;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
@@ -873,7 +881,7 @@ namespace TEAMModelOS.Controllers
|
|
|
teacherFile = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherFile>(teacherFile, teacherFile.id, new PartitionKey(teacherFile.code));
|
|
|
item.update.Add(StatisticsService.TeacherAbility);
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync<TeacherTrain>(item, item.id, new PartitionKey(item.code));
|
|
|
- */
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
right.Add(item.id);
|