...
|
...
|
@@ -604,13 +604,43 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo |
|
|
|
|
|
func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContext application.TransactionContext, project *domain.EvaluationProject) error {
|
|
|
|
|
|
// var itemUsedList []*domain.EvaluationItemUsed
|
|
|
// for _, v := range project.Template.LinkNodes {
|
|
|
// for _, v2 := range v.NodeContents {
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
var itemUsedList []*domain.EvaluationItemUsed
|
|
|
nowTime := time.Now()
|
|
|
for _, v := range project.Template.LinkNodes {
|
|
|
for i2, v2 := range v.NodeContents {
|
|
|
item := domain.EvaluationItemUsed{
|
|
|
Id: 0,
|
|
|
CompanyId: int(project.CompanyId),
|
|
|
EvaluationProjectId: int(project.Id),
|
|
|
NodeId: int(v.Id),
|
|
|
NodeType: v.Type,
|
|
|
SortBy: i2,
|
|
|
Category: v2.Category,
|
|
|
Name: v2.Name,
|
|
|
PromptTitle: v2.PromptTitle,
|
|
|
PromptText: v2.PromptText,
|
|
|
EntryItems: v2.EntryItems,
|
|
|
Weight: v2.Weight,
|
|
|
Required: v2.Required,
|
|
|
EvaluatorId: int(v2.EvaluatorId),
|
|
|
CreatedAt: nowTime,
|
|
|
UpdatedAt: nowTime,
|
|
|
// RuleType: 0,
|
|
|
// Rule: *v2.Rule,
|
|
|
}
|
|
|
if v2.Rule != nil {
|
|
|
item.RuleType = v2.Rule.Type
|
|
|
item.Rule = *v2.Rule
|
|
|
}
|
|
|
itemUsedList = append(itemUsedList, &item)
|
|
|
}
|
|
|
}
|
|
|
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
err := itemUsedRepo.BatchInsert(itemUsedList)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return nil
|
|
|
} |
...
|
...
|
|