diff --git a/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set.go b/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set.go index 5041259e1..2c23e4f51 100644 --- a/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set.go +++ b/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set.go @@ -136,7 +136,7 @@ func UploadAttachmentDetailDO2DTO(do *entity.UploadAttachmentDetail) *app_eval_s if do == nil { return nil } - return &app_eval_set.UploadAttachmentDetail{ + dto := &app_eval_set.UploadAttachmentDetail{ ContentType: contentTypeDO2DTO(do.ContentType), ImagexServiceID: do.ImagexServiceID, OriginImage: common.ConvertImageDO2DTO(do.OriginImage), @@ -146,8 +146,11 @@ func UploadAttachmentDetailDO2DTO(do *entity.UploadAttachmentDetail) *app_eval_s OriginVideo: common.ConvertVideoDO2DTO(do.OriginVideo), Video: common.ConvertVideoDO2DTO(do.Video), ErrMsg: do.ErrMsg, - ErrorType: gptr.Of(dataset.ItemErrorType(gptr.Indirect(do.ErrorType))), } + if do.ErrorType != nil { + dto.ErrorType = gptr.Of(dataset.ItemErrorType(gptr.Indirect(do.ErrorType))) + } + return dto } func contentTypeDO2DTO(ct *entity.ContentType) *dataset.ContentType { diff --git a/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set_simple_test.go b/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set_simple_test.go index 8bc351226..44644351e 100755 --- a/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set_simple_test.go +++ b/backend/modules/evaluation/application/convertor/evaluation_set/evaluation_set_simple_test.go @@ -294,7 +294,6 @@ func TestUploadAttachmentDetailDO2DTO(t *testing.T) { input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentTypeText)}, expected: &app_eval_set.UploadAttachmentDetail{ ContentType: gptr.Of(dataset.ContentType_Text), - ErrorType: gptr.Of(dataset.ItemErrorType(0)), }, }, { @@ -302,7 +301,6 @@ func TestUploadAttachmentDetailDO2DTO(t *testing.T) { input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentTypeImage)}, expected: &app_eval_set.UploadAttachmentDetail{ ContentType: gptr.Of(dataset.ContentType_Image), - ErrorType: gptr.Of(dataset.ItemErrorType(0)), }, }, { @@ -310,7 +308,6 @@ func TestUploadAttachmentDetailDO2DTO(t *testing.T) { input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentTypeAudio)}, expected: &app_eval_set.UploadAttachmentDetail{ ContentType: gptr.Of(dataset.ContentType_Audio), - ErrorType: gptr.Of(dataset.ItemErrorType(0)), }, }, { @@ -318,7 +315,6 @@ func TestUploadAttachmentDetailDO2DTO(t *testing.T) { input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentTypeVideo)}, expected: &app_eval_set.UploadAttachmentDetail{ ContentType: gptr.Of(dataset.ContentType_Video), - ErrorType: gptr.Of(dataset.ItemErrorType(0)), }, }, { @@ -326,22 +322,17 @@ func TestUploadAttachmentDetailDO2DTO(t *testing.T) { input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentTypeMultipart)}, expected: &app_eval_set.UploadAttachmentDetail{ ContentType: gptr.Of(dataset.ContentType_MultiPart), - ErrorType: gptr.Of(dataset.ItemErrorType(0)), }, }, { - name: "unknown content type", - input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentType("unknown"))}, - expected: &app_eval_set.UploadAttachmentDetail{ - ErrorType: gptr.Of(dataset.ItemErrorType(0)), - }, + name: "unknown content type", + input: &entity.UploadAttachmentDetail{ContentType: gptr.Of(entity.ContentType("unknown"))}, + expected: &app_eval_set.UploadAttachmentDetail{}, }, { - name: "nil content type", - input: &entity.UploadAttachmentDetail{}, - expected: &app_eval_set.UploadAttachmentDetail{ - ErrorType: gptr.Of(dataset.ItemErrorType(0)), - }, + name: "nil content type", + input: &entity.UploadAttachmentDetail{}, + expected: &app_eval_set.UploadAttachmentDetail{}, }, { name: "full fields",