|
@@ -47,7 +47,7 @@ namespace TEAMModelOS.Controllers
|
|
|
[ProducesDefaultResponseType]
|
|
|
//[AuthToken(Roles = "teacher")]
|
|
|
[HttpPost("fix-ability-task")]
|
|
|
- public async Task<IActionResult> FixStudentId(JsonElement data)
|
|
|
+ public async Task<IActionResult> FixAbilityTask(JsonElement data)
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var queryslt = $"SELECT value(c) FROM c where c.pk='AbilityTask'";
|
|
@@ -88,5 +88,39 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
return Ok();
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 修复学生的id
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="data"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ //[AuthToken(Roles = "teacher")]
|
|
|
+ [HttpPost("fix-ability")]
|
|
|
+ public async Task<IActionResult> FixAbility(JsonElement data)
|
|
|
+ {
|
|
|
+ var Normal = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal");
|
|
|
+ var queryslt = $"SELECT value(c) FROM c where c.pk='Ability'";
|
|
|
+ List<Ability> abilities = new List<Ability>();
|
|
|
+ await foreach (var item in Normal.GetItemQueryIterator<Ability>(queryText: queryslt))
|
|
|
+ {
|
|
|
+ if (item.compulsory.HasValue) {
|
|
|
+ if (item.compulsory.Value == true)
|
|
|
+ {
|
|
|
+ item.currency =1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ item.currency = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ item.currency = 2;
|
|
|
+ }
|
|
|
+ abilities.Add(item);
|
|
|
+ }
|
|
|
+ foreach (var item in abilities) {
|
|
|
+ await Normal.ReplaceItemAsync(item, item.id, new PartitionKey(item.code));
|
|
|
+ }
|
|
|
+ return Ok();
|
|
|
+ }
|
|
|
}
|
|
|
}
|