|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
using MathNet.Numerics.Distributions; |
|
|
|
|
using Google.Protobuf.WellKnownTypes; |
|
|
|
|
using MathNet.Numerics.Distributions; |
|
|
|
|
using Tiobon.Core.Common; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
@ -231,6 +232,14 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
case "Multiple": |
|
|
|
|
case "MultipleScore": |
|
|
|
|
question.Value1 = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).ToList(); |
|
|
|
|
|
|
|
|
|
if (question.Options.Where(x => question.Value1.Contains(x.OptionNo) && x.IsOther == true).Any()) |
|
|
|
|
question.Options.ForEach(o => |
|
|
|
|
{ |
|
|
|
|
if (question.Value1.Contains(o.OptionNo) && o.IsOther == true) |
|
|
|
|
o.OtherContent = recordOptions.Where(x => x.SurveyQuestionId == question.Id && x.SurveyQuestionOptionId == o.Id) |
|
|
|
|
.Select(x => x.Reverse1).FirstOrDefault() ?? ""; |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "Single": |
|
|
|
@ -238,8 +247,13 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
case "SingleScore": |
|
|
|
|
case "Rate": |
|
|
|
|
case "Scale": |
|
|
|
|
question.Value = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).Any() ? recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).FirstOrDefault() : ""; |
|
|
|
|
|
|
|
|
|
question.Value = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).FirstOrDefault() ?? ""; |
|
|
|
|
if (question.Options.Where(x => x.OptionNo == question.Value && x.IsOther == true).Any()) |
|
|
|
|
question.Options.ForEach(o => |
|
|
|
|
{ |
|
|
|
|
if (o.OptionNo == question.Value && o.IsOther == true) |
|
|
|
|
o.OtherContent = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.Reverse1).FirstOrDefault() ?? ""; |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
@ -314,19 +328,45 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
StaffId = App.User.StaffId, |
|
|
|
|
Score = 0 |
|
|
|
|
}; |
|
|
|
|
option1.SurveyQuestionOptionId = question.Options.Where(x => x.OptionNo == question.Value1[j]).FirstOrDefault()?.Id; |
|
|
|
|
|
|
|
|
|
var questionOption1 = question.Options.Where(x => x.OptionNo == question.Value1[j]).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
option1.SurveyQuestionOptionId = questionOption1?.Id; |
|
|
|
|
option1.OptionContent = question.Value1[j]; |
|
|
|
|
|
|
|
|
|
if (questionOption1.IsOther == true) |
|
|
|
|
option1.Reverse1 = questionOption1.OtherContent; |
|
|
|
|
await Db.Insertable(option1).ExecuteReturnSnowflakeIdAsync(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "Single": |
|
|
|
|
case "ShortAnswer": |
|
|
|
|
case "SingleScore": |
|
|
|
|
var option = new Ghre_SurveyRecordOption() |
|
|
|
|
{ |
|
|
|
|
SurveyId = id, |
|
|
|
|
SurveyRecordId = recordId, |
|
|
|
|
SurveyRecordDetailId = recordDetailId, |
|
|
|
|
SurveyQuestionId = question.Id, |
|
|
|
|
//SurveyQuestionOptionId = x.Id, |
|
|
|
|
StaffId = App.User.StaffId, |
|
|
|
|
Score = 0 |
|
|
|
|
}; |
|
|
|
|
var questionOption = question.Options.Where(x => x.OptionNo == question.Value).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
option.SurveyQuestionOptionId = questionOption?.Id; |
|
|
|
|
option.OptionContent = question.Value; |
|
|
|
|
if (questionOption.IsOther == true) |
|
|
|
|
option.Reverse1 = questionOption.OtherContent; |
|
|
|
|
await Db.Insertable(option).ExecuteReturnSnowflakeIdAsync(); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "Rate": |
|
|
|
|
case "Scale": |
|
|
|
|
var option = new Ghre_SurveyRecordOption() |
|
|
|
|
case "ShortAnswer": |
|
|
|
|
option = new Ghre_SurveyRecordOption() |
|
|
|
|
{ |
|
|
|
|
SurveyId = id, |
|
|
|
|
SurveyRecordId = recordId, |
|
|
|
@ -336,7 +376,7 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
StaffId = App.User.StaffId, |
|
|
|
|
Score = 0 |
|
|
|
|
}; |
|
|
|
|
option.SurveyQuestionOptionId = question.Options.Where(x => x.OptionNo == question.Value).FirstOrDefault()?.Id; |
|
|
|
|
|
|
|
|
|
option.OptionContent = question.Value; |
|
|
|
|
await Db.Insertable(option).ExecuteReturnSnowflakeIdAsync(); |
|
|
|
|
|
|
|
|
|