|
@@ -143,7 +143,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- //if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//string school_code = code.ToString().Substring(typeof(ExamClassResult).Name.Length + 1);
|
|
|
var response = await client.GetContainer("TEAMModelOS", "Common").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
@@ -189,7 +189,8 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//if (!requert.TryGetProperty("id_token", out JsonElement id_token)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ //if (!requert.TryGetProperty("school", out JsonElement school_code)) return BadRequest();
|
|
|
//if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
|
//var jwt = new JwtSecurityToken(id_token.GetString());
|
|
|
//if (!jwt.Payload.Iss.Equals("account.teammodel", StringComparison.Ordinal)) return BadRequest();
|
|
@@ -197,7 +198,7 @@ namespace TEAMModelOS.Controllers
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<ExamInfo> examInfo = new List<ExamInfo>();
|
|
|
var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.stuCount,c.type,c.progress,c.examType,c.createTime from c ";
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school_code}") }))
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{code}") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -208,7 +209,7 @@ namespace TEAMModelOS.Controllers
|
|
|
examInfo.Add(obj.ToObject<ExamInfo>());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
return Ok(new { examInfo });
|
|
|
/*if (StringHelper.getKeyCount(request) > 0)
|
|
|
{
|
|
@@ -243,7 +244,7 @@ namespace TEAMModelOS.Controllers
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<ExamInfo> examInfo = new List<ExamInfo>();
|
|
|
//var query = $"select value(c) from c ";
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: $"select value(c) from c where c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: $"select value(c) from c where c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{code}") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -285,7 +286,8 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!request.TryGetProperty("multipleRule", out JsonElement multipleRule)) return BadRequest();
|
|
|
//if (!request.TryGetProperty("answers ", out JsonElement tandardAnswer)) return BadRequest();
|
|
|
if (!request.TryGetProperty("paperId", out JsonElement paperId)) return BadRequest();
|
|
|
- if (!request.TryGetProperty("school", out JsonElement school)) return BadRequest();
|
|
|
+ //根据不同评测的类型返回对应的编码
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
try
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
@@ -303,6 +305,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
ExamClassResult classResult = new ExamClassResult() ;
|
|
|
List<PaperSimple> standerAnswers = new List<PaperSimple>();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(
|
|
@@ -505,7 +508,8 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!request.TryGetProperty("point", out JsonElement point)) return BadRequest();
|
|
|
if (!request.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
if (!request.TryGetProperty("classId", out JsonElement classId)) return BadRequest();
|
|
|
- if (!request.TryGetProperty("school", out JsonElement school)) return BadRequest();
|
|
|
+ //此参数表明此次操作对象为个人还是校本的评测内容
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
//要先处理状态,判断卷子是否存在,并判断卷子归属的考试是否允许再次提交
|
|
|
//List<ExamInfo> exams = await _azureCosmos.FindByDict<ExamInfo>(new Dictionary<string, object> { { "id", request.examCode } });
|
|
@@ -619,7 +623,7 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
//if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("school", out JsonElement school_code)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
if (!requert.TryGetProperty("classId", out JsonElement classId)) return BadRequest();
|
|
|
// 如果只有学生id则返回学生参加过的考试 只返回相关摘要信息
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
@@ -696,9 +700,9 @@ namespace TEAMModelOS.Controllers
|
|
|
try
|
|
|
{
|
|
|
if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("school", out JsonElement school)) return BadRequest();
|
|
|
+ if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var query = $"select c.id,c.code,A0.id paperId,A0.code paperCode,A0.name paperName,A0.multipleRule,A0.scope,A0.blob from c join A0 in c.papers where c.id ='{id}'";
|
|
|
List<object> papers = new List<object>();
|