|
@@ -709,7 +709,8 @@ namespace TEAMModelOS.Controllers
|
|
|
if (!requert.TryGetProperty("school", 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> props = new List<object>();
|
|
|
+ List<object> papers = new List<object>();
|
|
|
+ List<object> subjects = new List<object>();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
@@ -717,11 +718,11 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
- props.Add(obj.ToObject<object>());
|
|
|
+ papers.Add(obj.ToObject<object>());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- var querySubject = $"select c.subjects from c where c.id ='{id}'";
|
|
|
+ var querySubject = $"select A0.id,A0.name from c join A0 in c.subjects where c.id ='{id}'";
|
|
|
//List<object> props = new List<object>();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
|
|
|
{
|
|
@@ -730,7 +731,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
- props.Add(obj.ToObject<object>());
|
|
|
+ subjects.Add(obj.ToObject<object>());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -748,7 +749,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<List<List<string>>> stuAns = new List<List<List<string>>>();
|
|
|
+ //List<List<List<string>>> stuAns = new List<List<List<string>>>();
|
|
|
List<List<double>> stuScore = new List<List<double>>();
|
|
|
List<double> total = new List<double>();
|
|
|
if (answers.Count > 0)
|
|
@@ -759,7 +760,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
- stuAns.Add(result.studentAnswers[index]);
|
|
|
+ // stuAns.Add(result.studentAnswers[index]);
|
|
|
stuScore.Add(result.studentScores[index]);
|
|
|
total.Add(result.sum.Where(s => s <= 59).Count());
|
|
|
total.Add(result.sum.Where(s => s > 59 && s <= 70 ).Count());
|
|
@@ -768,7 +769,7 @@ namespace TEAMModelOS.Controllers
|
|
|
total.Add(result.sum.Where(s => s > 90 && s <= 100).Count());
|
|
|
}
|
|
|
}
|
|
|
- return Ok(new { props, stuAns ,stuScore, total });
|
|
|
+ return Ok(new { papers, subjects,stuScore, total });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|