| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- using Newtonsoft.Json;
- using System.Collections.Generic;
- namespace DaJiaoYan.Models
- {
- /// <summary>
- /// 划分模版
- /// </summary>
- public class DividePartitionConfig
- {
- [JsonProperty(PropertyName = "test_name")]
- public string Name { get; set; }
- [JsonProperty(PropertyName = "subject_id")]
- public int SubjectId { get; set; }
- // TODO 需要服务端返回模版所属考试id
- public int ExamId { get; set; }
- public int TestId { get; set; }
- [JsonProperty(PropertyName = "test_correct_type")]
- public Enumerates.TestCorrectType TestCorrectType { get; set; }
- /// <summary>
- /// 是否自动分配老师阅卷;
- /// true自动分配
- /// </summary>
- [JsonProperty(PropertyName = "auto_assign_teacher_marking")]
- public bool AutoAssignTeacherMarking { get; set; }
- [JsonProperty(PropertyName = "answer_sheet")]
- public TestAnswerSheet[] AnswerSheets { get; set; }
- [JsonProperty(PropertyName = "template_info")]
- public TestTemplate Template { get; set; }
- [JsonProperty(PropertyName = "data")]
- public List<PartitionConfig> Partitions { get; set; }
- /// <summary>
- /// 客观题数量
- /// </summary>
- //public int ObjectiveQuestCount { get; set; }
- public void SetObjectivePaintThreshold(PartitionConfig p, Dictionary<string, double> baseThreshold, int weights)
- {
- if (p.Config.OptionRects != null)
- {
- // 设置客观题填涂阈值
- foreach (var op in p.Config.OptionRects)
- {
- //op.PaintThreshold = baseThreshold[op.Option.ToUpper()] + weights / 100.0;
- op.PaintThreshold = 0.01 + weights / 100.0;
- if (op.PaintThreshold > 0.9)
- {
- op.PaintThreshold = 0.9;
- }
- }
- }
- }
- /// <summary>
- /// 识别前预处理
- /// </summary>
- /// <param name="baseThreshold"></param>
- /// <param name="weights"></param>
- public void Init(Dictionary<string, double> baseThreshold = null, int weights = 0)
- {
- //Dictionary<string, int> objectives = new Dictionary<string, int>();
- Partitions.ForEach(p =>
- {
- //if (p.Config.CorrectType == Enumerates.QuestionType.Objective)
- //{
- // if (Template.ParsedVersion == TestTemplate.TemplateVersion.V2)
- // {
- // ObjectiveQuestCount += p.Config.RectDivides.Keys.Count;
- // }
- // else
- // {
- // p.Config.OptionRects.ForEach(op =>
- // {
- // if( !objectives.ContainsKey(op.Key) )
- // {
- // objectives[op.Key] = 0;
- // }
- // });
- // }
- //}
- SetObjectivePaintThreshold(p, baseThreshold, weights);
- });
- //ObjectiveQuestCount += objectives.Keys.Count;
- }
- }
- }
|