|
@@ -41,19 +41,19 @@ namespace TEAMModelFunction
|
|
|
adcode = $"Activity-{tdata.creatorId}";
|
|
|
blobcntr = tdata.creatorId;
|
|
|
}
|
|
|
- ActivityData data = null;
|
|
|
- try
|
|
|
- {
|
|
|
- if (tdata.scope == "school")
|
|
|
- {
|
|
|
- data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
|
|
|
- }
|
|
|
- else if (tdata.scope == "private")
|
|
|
- {
|
|
|
- data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
|
|
|
- }
|
|
|
- }
|
|
|
- catch { data = null; }
|
|
|
+ //ActivityData data = null;
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ // if (tdata.scope == "school")
|
|
|
+ // {
|
|
|
+ // data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
|
|
|
+ // }
|
|
|
+ // else if (tdata.scope == "private")
|
|
|
+ // {
|
|
|
+ // data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //catch { data = null; }
|
|
|
Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(input.Id, new Azure.Cosmos.PartitionKey($"{tdata.code}"));
|
|
|
List<ChangeRecord> changeRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input.Id }, { "PartitionKey", survey.progress } });
|
|
|
if (survey != null) {
|
|
@@ -83,44 +83,44 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
break;
|
|
|
case "going":
|
|
|
- if (survey.scope == "school")
|
|
|
- {
|
|
|
- data = new ActivityData
|
|
|
- {
|
|
|
- id = survey.id,
|
|
|
- code = $"Activity-{survey.school}",
|
|
|
- type = "survey",
|
|
|
- name = survey.name,
|
|
|
- startTime = survey.startTime,
|
|
|
- endTime = survey.endTime,
|
|
|
- scode = survey.code,
|
|
|
- scope = survey.scope,
|
|
|
- classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
|
|
|
- tmdids = survey.tmdids.IsNotEmpty() ? survey.tmdids : new List<string> { "" },
|
|
|
- progress = "going",
|
|
|
- subjects = new List<string> { "" }
|
|
|
- };
|
|
|
- await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
- }
|
|
|
- else if (survey.scope == "private")
|
|
|
- {
|
|
|
- data = new ActivityData
|
|
|
- {
|
|
|
- id = survey.id,
|
|
|
- code = $"Activity-Common",
|
|
|
- type = "survey",
|
|
|
- name = survey.name,
|
|
|
- startTime = survey.startTime,
|
|
|
- endTime = survey.endTime,
|
|
|
- scode = survey.code,
|
|
|
- scope = survey.scope,
|
|
|
- progress = "going",
|
|
|
- classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
|
|
|
- tmdids = new List<string> { "" },
|
|
|
- subjects = new List<string> { "" }
|
|
|
- };
|
|
|
- await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
- }
|
|
|
+ //if (survey.scope == "school")
|
|
|
+ //{
|
|
|
+ // data = new ActivityData
|
|
|
+ // {
|
|
|
+ // id = survey.id,
|
|
|
+ // code = $"Activity-{survey.school}",
|
|
|
+ // type = "survey",
|
|
|
+ // name = survey.name,
|
|
|
+ // startTime = survey.startTime,
|
|
|
+ // endTime = survey.endTime,
|
|
|
+ // scode = survey.code,
|
|
|
+ // scope = survey.scope,
|
|
|
+ // classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
|
|
|
+ // tmdids = survey.tmdids.IsNotEmpty() ? survey.tmdids : new List<string> { "" },
|
|
|
+ // progress = "going",
|
|
|
+ // subjects = new List<string> { "" }
|
|
|
+ // };
|
|
|
+ // await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
+ //}
|
|
|
+ //else if (survey.scope == "private")
|
|
|
+ //{
|
|
|
+ // data = new ActivityData
|
|
|
+ // {
|
|
|
+ // id = survey.id,
|
|
|
+ // code = $"Activity-Common",
|
|
|
+ // type = "survey",
|
|
|
+ // name = survey.name,
|
|
|
+ // startTime = survey.startTime,
|
|
|
+ // endTime = survey.endTime,
|
|
|
+ // scode = survey.code,
|
|
|
+ // scope = survey.scope,
|
|
|
+ // progress = "going",
|
|
|
+ // classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
|
|
|
+ // tmdids = new List<string> { "" },
|
|
|
+ // subjects = new List<string> { "" }
|
|
|
+ // };
|
|
|
+ // await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
+ //}
|
|
|
|
|
|
(List<string> tmdids,List<Students> students) = await TriggerStuActivity. GetStuList(client, survey.classes, survey.school);
|
|
|
await _dingDing.SendBotMsg($"问卷调查{tdata.id}写入学生表作为活动列表!", GroupNames.成都开发測試群組);
|
|
@@ -130,7 +130,7 @@ namespace TEAMModelFunction
|
|
|
tmdids.ForEach(x=> {
|
|
|
tmdActivities.Add(new StuActivity
|
|
|
{
|
|
|
- pk= "Activity",
|
|
|
+ pk = "Activity",
|
|
|
id = survey.id,
|
|
|
code = $"Activity-{x}",
|
|
|
type = "survey",
|
|
@@ -139,9 +139,10 @@ namespace TEAMModelFunction
|
|
|
endTime = survey.endTime,
|
|
|
scode = survey.code,
|
|
|
scope = survey.scope,
|
|
|
- school=survey.school,
|
|
|
- creatorId=survey.creatorId,
|
|
|
- subjects = new List<string> { "" }
|
|
|
+ school = survey.school,
|
|
|
+ creatorId = survey.creatorId,
|
|
|
+ subjects = new List<string> { "" },
|
|
|
+ blob = survey.blob
|
|
|
|
|
|
});
|
|
|
});
|
|
@@ -160,7 +161,8 @@ namespace TEAMModelFunction
|
|
|
scope = survey.scope,
|
|
|
school = survey.school,
|
|
|
creatorId = survey.creatorId,
|
|
|
- subjects = new List<string> { "" }
|
|
|
+ subjects = new List<string> { "" },
|
|
|
+ blob = survey.blob
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -280,15 +282,15 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
|
|
|
//更新结束状态
|
|
|
- data.progress = "finish";
|
|
|
- if (survey.scope == "school")
|
|
|
- {
|
|
|
- await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
- }
|
|
|
- else if (survey.scope == "private")
|
|
|
- {
|
|
|
- await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
- }
|
|
|
+ //data.progress = "finish";
|
|
|
+ //if (survey.scope == "school")
|
|
|
+ //{
|
|
|
+ // await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
+ //}
|
|
|
+ //else if (survey.scope == "private")
|
|
|
+ //{
|
|
|
+ // await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
|
|
|
+ //}
|
|
|
|
|
|
break;
|
|
|
}
|