From e01bc3e43838e8821c0b58239030913029981cc4 Mon Sep 17 00:00:00 2001 From: "zhuangjiaqi.777" Date: Mon, 30 Mar 2026 22:02:19 +0800 Subject: [PATCH 1/2] fix: error type --- .../application/convertor/evaluation_set/evaluation_set.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 { From 6b36fbfd5b55fa485bde3b0e27ed17d8a0b161f3 Mon Sep 17 00:00:00 2001 From: "zhuangjiaqi.777" Date: Tue, 31 Mar 2026 11:25:44 +0800 Subject: [PATCH 2/2] chore: ut --- .../evaluation_set_simple_test.go | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) 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",