|
@@ -91,7 +91,7 @@ namespace TEAMModelOS.SDK
|
|
/// <param name="azureRedis"></param>
|
|
/// <param name="azureRedis"></param>
|
|
public static async Task<List<StudentActivity>> FindActivity(JsonElement request, string userId, string userScope, List<string> groupListIds, List<string> subjects, string school, List<string> types, AzureCosmosFactory _azureCosmos)
|
|
public static async Task<List<StudentActivity>> FindActivity(JsonElement request, string userId, string userScope, List<string> groupListIds, List<string> subjects, string school, List<string> types, AzureCosmosFactory _azureCosmos)
|
|
{
|
|
{
|
|
- string filed = "c.id ,c.code,c.owner,c.pk,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
|
|
|
|
|
|
+ string filed = "c.id ,c.code,c.owner,c.pk as type,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
|
|
if (string.IsNullOrWhiteSpace(school))
|
|
if (string.IsNullOrWhiteSpace(school))
|
|
{
|
|
{
|
|
if (request.TryGetProperty("school", out JsonElement schooljson))
|
|
if (request.TryGetProperty("school", out JsonElement schooljson))
|
|
@@ -137,7 +137,7 @@ namespace TEAMModelOS.SDK
|
|
throw new Exception("名单为空");
|
|
throw new Exception("名单为空");
|
|
}
|
|
}
|
|
|
|
|
|
- List<StudentActivity> activities = new List<StudentActivity>();
|
|
|
|
|
|
+ List<StudentActivity> datas = new List<StudentActivity>();
|
|
if (types.IsEmpty() || types.Contains("Exam"))
|
|
if (types.IsEmpty() || types.Contains("Exam"))
|
|
{
|
|
{
|
|
string subjectSQL = "";
|
|
string subjectSQL = "";
|
|
@@ -154,7 +154,7 @@ namespace TEAMModelOS.SDK
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.owner='school' ", $"Exam-{school}");
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.owner='school' ", $"Exam-{school}");
|
|
if (resultSchool.list.Count > 0) {
|
|
if (resultSchool.list.Count > 0) {
|
|
List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultSchool.list, school, userId, userScope);
|
|
List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultSchool.list, school, userId, userScope);
|
|
- activities.AddRange(activity);
|
|
|
|
|
|
+ datas.AddRange(activity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
@@ -162,7 +162,7 @@ namespace TEAMModelOS.SDK
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.owner='teacher' ");
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.owner='teacher' ");
|
|
if(resultTeacher.list.Count > 0) {
|
|
if(resultTeacher.list.Count > 0) {
|
|
List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultTeacher.list, school, userId, userScope);
|
|
List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultTeacher.list, school, userId, userScope);
|
|
- activities.AddRange(resultTeacher.list);
|
|
|
|
|
|
+ datas.AddRange(resultTeacher.list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -176,12 +176,12 @@ namespace TEAMModelOS.SDK
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
{
|
|
{
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Vote-{school}");
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Vote-{school}");
|
|
- activities.AddRange(resultSchool.list);
|
|
|
|
|
|
+ datas.AddRange(resultSchool.list);
|
|
}
|
|
}
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
{
|
|
{
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
- activities.AddRange(resultTeacher.list);
|
|
|
|
|
|
+ datas.AddRange(resultTeacher.list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (types.IsEmpty() || types.Contains("Survey"))
|
|
if (types.IsEmpty() || types.Contains("Survey"))
|
|
@@ -192,12 +192,12 @@ namespace TEAMModelOS.SDK
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
{
|
|
{
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Survey-{school}");
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Survey-{school}");
|
|
- activities.AddRange(resultSchool.list);
|
|
|
|
|
|
+ datas.AddRange(resultSchool.list);
|
|
}
|
|
}
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
{
|
|
{
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
- activities.AddRange(resultTeacher.list);
|
|
|
|
|
|
+ datas.AddRange(resultTeacher.list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (types.IsEmpty() || types.Contains("Homework"))
|
|
if (types.IsEmpty() || types.Contains("Homework"))
|
|
@@ -208,12 +208,12 @@ namespace TEAMModelOS.SDK
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
{
|
|
{
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Homework-{school}");
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='school' ", $"Homework-{school}");
|
|
- activities.AddRange(resultSchool.list);
|
|
|
|
|
|
+ datas.AddRange(resultSchool.list);
|
|
}
|
|
}
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
//获取教师发布的活动(个人名单,学校名单)
|
|
{
|
|
{
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()} and c.owner='teacher' ");
|
|
- activities.AddRange(resultTeacher.list);
|
|
|
|
|
|
+ datas.AddRange(resultTeacher.list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (types.IsEmpty() || types.Contains("Art"))
|
|
if (types.IsEmpty() || types.Contains("Art"))
|
|
@@ -231,11 +231,11 @@ namespace TEAMModelOS.SDK
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
|
|
{
|
|
{
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.school='{school}' ", $"Art-{school}");
|
|
var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL} and c.school='{school}' ", $"Art-{school}");
|
|
- activities.AddRange(resultSchool.list);
|
|
|
|
|
|
+ datas.AddRange(resultSchool.list);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//作答 记录recordUrl taskStatus
|
|
//作答 记录recordUrl taskStatus
|
|
- return activities;
|
|
|
|
|
|
+ return datas;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -321,7 +321,7 @@ namespace TEAMModelOS.SDK
|
|
id = x.id,
|
|
id = x.id,
|
|
stuId = userId,
|
|
stuId = userId,
|
|
userType = userScope,
|
|
userType = userScope,
|
|
- type = "Exam",
|
|
|
|
|
|
+ type = "Exam",
|
|
name = x.name,
|
|
name = x.name,
|
|
source = x.source,
|
|
source = x.source,
|
|
startTime = x.startTime,
|
|
startTime = x.startTime,
|
|
@@ -337,8 +337,8 @@ namespace TEAMModelOS.SDK
|
|
createTime = x.createTime,
|
|
createTime = x.createTime,
|
|
qamode = x.qamode,
|
|
qamode = x.qamode,
|
|
//taskStatus = et.Select(c => c[x.id]).FirstOrDefault(),
|
|
//taskStatus = et.Select(c => c[x.id]).FirstOrDefault(),
|
|
- ext = new Dictionary<string, JsonElement>() { { "type", !string.IsNullOrEmpty(x.examType) ? x.examType.ToJsonString().ToObject<JsonElement>():new JsonElement() },
|
|
|
|
- { "subjects", x.subjects.ToJsonString().ToObject<JsonElement>() } },
|
|
|
|
|
|
+ //ext = new Dictionary<string, JsonElement>() { { "type", !string.IsNullOrEmpty(x.examType) ? x.examType.ToJsonString().ToObject<JsonElement>():new JsonElement() },
|
|
|
|
+ //{ "subjects", x.subjects.ToJsonString().ToObject<JsonElement>() } },
|
|
taskStatus = et.Where(c => c.eId.Equals(x.id)).FirstOrDefault().status,
|
|
taskStatus = et.Where(c => c.eId.Equals(x.id)).FirstOrDefault().status,
|
|
sStatus = es.Where(z => z.eId.Equals(x.id)).FirstOrDefault().flag ? 1 : 0
|
|
sStatus = es.Where(z => z.eId.Equals(x.id)).FirstOrDefault().flag ? 1 : 0
|
|
//sStatus = es.Select(c => c[x.id]).FirstOrDefault() ? 1 : 0
|
|
//sStatus = es.Select(c => c[x.id]).FirstOrDefault() ? 1 : 0
|