|
@@ -1653,15 +1653,18 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("et", out JsonElement et)) return BadRequest();
|
|
|
//if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
long time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
+ if (et.GetInt64() > time) {
|
|
|
+ return Ok(new { msg = "还在进行中", code = 202 });
|
|
|
+ }
|
|
|
ExamInfo info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
List<ExamClassResult> classResults = new();
|
|
|
List<SDK.Models.Cosmos.Common.Scoring> attr = new List<SDK.Models.Cosmos.Common.Scoring>();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<SDK.Models.Cosmos.Common.Scoring>(
|
|
|
- queryText: $"select value(c) from c where c.examId = '{id}' and c.subjectId = '{subjectId}' and c.endTime < {time}",
|
|
|
+ queryText: $"select value(c) from c where c.examId = '{id}' and c.subjectId = '{subjectId}'",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Scoring-{code}") }))
|
|
|
{
|
|
|
attr.Add(item);
|
|
@@ -2206,7 +2209,7 @@ namespace TEAMModelOS.Controllers
|
|
|
return Ok(attr);
|
|
|
}
|
|
|
|
|
|
- //处理异常卷内容
|
|
|
+ //申报异常卷内容
|
|
|
[ProducesDefaultResponseType]
|
|
|
//[AuthToken(Roles = "Student")]
|
|
|
[HttpPost("save-err")]
|
|
@@ -2228,7 +2231,7 @@ namespace TEAMModelOS.Controllers
|
|
|
scoring.qs[index.GetInt32()].index = index.GetInt32();
|
|
|
}
|
|
|
else {
|
|
|
- return Ok(new { msg = "改题已经被申报" });
|
|
|
+ return Ok(new { msg = "改题已经被申报", code = 404 });
|
|
|
}
|
|
|
|
|
|
/* scoring.type = 2;
|
|
@@ -2241,6 +2244,43 @@ namespace TEAMModelOS.Controllers
|
|
|
return Ok( new { sc });
|
|
|
}
|
|
|
|
|
|
+ //处理异常卷内容
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ //[AuthToken(Roles = "Student")]
|
|
|
+ [HttpPost("fd-err")]
|
|
|
+ public async Task<IActionResult> fdErr(JsonElement requert)
|
|
|
+ {
|
|
|
+ if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("improve", out JsonElement improve)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("index", out JsonElement index)) return BadRequest();
|
|
|
+ //if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
+ SDK.Models.Cosmos.Common.Scoring scoring = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<SDK.Models.Cosmos.Common.Scoring>(id.GetString(), new PartitionKey($"Scoring-{code}"));
|
|
|
+ if (null != scoring)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(scoring.qs[index.GetInt32()].improve))
|
|
|
+ {
|
|
|
+ scoring.qs[index.GetInt32()].improve = improve.GetString();
|
|
|
+ //scoring.qs[index.GetInt32()].tId = tId.GetString();
|
|
|
+ //scoring.qs[index.GetInt32()].index = index.GetInt32();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { msg = "改题已经被处理",code = 404 });
|
|
|
+ }
|
|
|
+
|
|
|
+ /* scoring.type = 2;
|
|
|
+ scoring.err = err.GetString();*/
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { code = 404 });
|
|
|
+ }
|
|
|
+ var sc = await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync(scoring, scoring.id, new PartitionKey($"{scoring.code}"));
|
|
|
+ return Ok(new { sc });
|
|
|
+ }
|
|
|
+
|
|
|
//处理仲裁卷内容
|
|
|
[ProducesDefaultResponseType]
|
|
|
//[AuthToken(Roles = "Student")]
|
|
@@ -2248,7 +2288,7 @@ namespace TEAMModelOS.Controllers
|
|
|
public async Task<IActionResult> saveArb(JsonElement requert)
|
|
|
{
|
|
|
if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("score", out JsonElement score)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("score", out JsonElement score)) return BadRequest();//就是一维数组
|
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<double> scs = score.ToObject<List<double>>();
|