|
@@ -834,27 +834,28 @@ namespace TEAMModelOS.Controllers
|
|
|
try
|
|
|
{
|
|
|
teacherFile = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<TeacherFile>($"{_tmdid}", new PartitionKey($"TeacherFile-{_school}"));
|
|
|
- fileRcds.ForEach(fileRcd => {
|
|
|
+ fileRcds.ForEach(fileRcd =>
|
|
|
+ {
|
|
|
var file = teacherFile.fileRecords.Find(x => x.hash.Equals(fileRcd.hash));
|
|
|
if (file != null)
|
|
|
{
|
|
|
file.hash = fileRcd.hash;
|
|
|
file.view = fileRcd.view;
|
|
|
file.done = fileRcd.done;
|
|
|
- FileAbility ability = file.files.Find(x => x.abilityId.Equals(fileRcd.abilityId)
|
|
|
- && x.url.Equals(fileRcd.url)&& x.taskId.Equals(fileRcd.taskId)
|
|
|
- && x.nodeId.Equals(fileRcd.nodeId));
|
|
|
+ FileAbility ability = file.files.Find(x => x.abilityId.Equals(fileRcd.abilityId)
|
|
|
+ && x.url.Equals(fileRcd.url) && x.taskId.Equals(fileRcd.taskId)
|
|
|
+ && x.nodeId.Equals(fileRcd?.nodeId));
|
|
|
if (ability != null)
|
|
|
{
|
|
|
ability.url = fileRcd.url;
|
|
|
ability.abilityId = fileRcd.abilityId;
|
|
|
ability.taskId = fileRcd.taskId;
|
|
|
ability.nodeId = fileRcd.nodeId;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- file.files.Add(new FileAbility { url = fileRcd.url, abilityId = fileRcd.abilityId, taskId = fileRcd.taskId, nodeId = fileRcd.nodeId, });
|
|
|
+ file.files.Add(new FileAbility { url = fileRcd.url, abilityId = fileRcd.abilityId, taskId = fileRcd.taskId, nodeId = fileRcd.nodeId, });
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -866,8 +867,8 @@ namespace TEAMModelOS.Controllers
|
|
|
duration = fileRcd.duration,
|
|
|
view = fileRcd.view,
|
|
|
type = fileRcd.type,
|
|
|
- done = fileRcd.done,
|
|
|
- files = new List<FileAbility> { new FileAbility { url = fileRcd.url, abilityId = fileRcd.abilityId, taskId = fileRcd.taskId, nodeId = fileRcd.nodeId, } }
|
|
|
+ done = fileRcd.done,
|
|
|
+ files = new List<FileAbility> { new FileAbility { url = fileRcd.url, abilityId = fileRcd.abilityId, taskId = fileRcd.taskId, nodeId = fileRcd.nodeId, } }
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -875,15 +876,16 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
catch (CosmosException)
|
|
|
{
|
|
|
- fileRcds.ForEach(fileRcd => {
|
|
|
+ fileRcds.ForEach(fileRcd =>
|
|
|
+ {
|
|
|
teacherFile = new TeacherFile
|
|
|
{
|
|
|
pk = "TeacherFile",
|
|
|
id = $"{_tmdid}",
|
|
|
code = $"TeacherFile-{_school}",
|
|
|
- fileRecords = new List<FileRecord>
|
|
|
+ fileRecords = new List<FileRecord>
|
|
|
{
|
|
|
- new FileRecord
|
|
|
+ new FileRecord
|
|
|
{
|
|
|
hash= fileRcd.hash,
|
|
|
size=fileRcd.size,
|
|
@@ -892,12 +894,15 @@ namespace TEAMModelOS.Controllers
|
|
|
type=fileRcd.type,
|
|
|
done=fileRcd.done,
|
|
|
files= new List<FileAbility> { new FileAbility { url=fileRcd.url,abilityId=fileRcd.abilityId,taskId=fileRcd.taskId,nodeId=fileRcd.nodeId} }
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
});
|
|
|
await client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<TeacherFile>(teacherFile, new PartitionKey($"TeacherFile-{_school}"));
|
|
|
}
|
|
|
+ catch (Exception ex ){
|
|
|
+ return BadRequest();
|
|
|
+ }
|
|
|
if (fileRcds.Exists(x => x.type.Equals("video"))) {
|
|
|
await StatisticsService.SendServiceBus( ($"{standard}",new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility },0) , _configuration, _serviceBus, client);
|
|
|
}
|
|
@@ -916,7 +921,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
-
|
|
|
+ return BadRequest(ex);
|
|
|
}
|
|
|
return Ok(new { status, files=_files });
|
|
|
case "ReadSelfVideoRcd":
|
|
@@ -938,7 +943,7 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
foreach (var abid in abilityIds) {
|
|
|
var record= teacherFilercd.fileRecords.FindAll(x => x.files.Where(y => y.abilityId.Equals(abid)).Count() > 0);
|
|
|
- long view = 0;
|
|
|
+ double view = 0;
|
|
|
List<dynamic> urls = new List<dynamic>();
|
|
|
record.ForEach(x => {
|
|
|
var file= x.files.FindAll(y => y.abilityId.Equals($"{abid}"));
|