From 1832f654ed7b91d420fd9c9105600a9f8bd9df67 Mon Sep 17 00:00:00 2001 From: hayato24s Date: Sat, 9 Mar 2024 13:09:18 +0900 Subject: [PATCH] WIP --- handler/api/rpc/shared/conv/type.go | 2 +- module/timetable/repository/registered_course.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/handler/api/rpc/shared/conv/type.go b/handler/api/rpc/shared/conv/type.go index d4a022a..35b7117 100644 --- a/handler/api/rpc/shared/conv/type.go +++ b/handler/api/rpc/shared/conv/type.go @@ -46,7 +46,7 @@ func ToPBRFC3339DateTime(t time.Time) *sharedpb.RFC3339DateTime { func FromPBRFC3339FullDate(pbFullDate *sharedpb.RFC3339FullDate) (civil.Date, error) { if pbFullDate == nil { - return civil.Date{}, errors.New("full date time must be present") + return civil.Date{}, errors.New("full date must be present") } return civil.ParseDate(pbFullDate.Value) } diff --git a/module/timetable/repository/registered_course.go b/module/timetable/repository/registered_course.go index c377d83..f8c1241 100644 --- a/module/timetable/repository/registered_course.go +++ b/module/timetable/repository/registered_course.go @@ -299,8 +299,13 @@ type dbRegisteredCourseSchedule struct { } func fromDBRegisteredCourseMethods(dbMethods string) ([]timetabledomain.CourseMethod, error) { + if dbMethods == "{}" { + return nil, nil + } + dbMethods = strings.TrimPrefix(dbMethods, "{") dbMethods = strings.TrimSuffix(dbMethods, "}") + return base.MapWithErr(strings.Split(dbMethods, ","), timetabledomain.ParseCourseMethod) }