Skip to content

workshop content#5

Open
yulian172 wants to merge 1 commit intotherizk:masterfrom
yulian172:workshop
Open

workshop content#5
yulian172 wants to merge 1 commit intotherizk:masterfrom
yulian172:workshop

Conversation

@yulian172
Copy link

No description provided.

"github.com/tokopedia/tokopoints/tracer"
)

func GetNilaiSiswa(ctx context.Context, nim int64, sekolah, kelas string, mapel_id int64) (resp GetNilaiSiswaResponse, err error) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameter nya bisa pake struct NilaiSiswa biar lebih dikit

return resp, errors.AddTrace(err)
}

detailSekolah, err := nilai.GetDetailSekolah(ctx, nilai.Sekolah[0])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bisa dicek dulu length dari nilai.Sekolah harus > 0

}

resp = mappingGetNilaiSiswa(nilai, detailSekolah)
} else if sekolah != "semua" {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"semua" bisa pake const

}

resp = mappingGetNilaiSiswa(nilai, detailSekolah)
} else if sekolah == "semua" {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"semua" bisa pake const

return resp, errors.AddTrace(err)
}

detailSekolah, err := nilai.GetDetailSekolah(ctx, nilai.Sekolah[0])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bisa dicek dulu length dari nilai.Sekolah harus > 0

func (s *server) GetNilaiSiswa(ctx context.Context, req *pb.GetNilaiSiswaRequest) (resp *pb.GetNilaiSiswaResponse, err error) {

if req.sekolah == "" {
req.sekolah = "semua"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"semua" bisa pake const

var err error
db, err = database.Get(database.PromoCatalog)
if err != nil {
log.Printf("Cannot connect to DB. %+v", err)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mungkin bisa diganti pake log.Fatal

Comment on lines +24 to +26
QueryGetNilaiSiswaByID = `select nim, mapel_id, nilai, sekolah, kelas
from nilai_siswa
where mapel_id = $1 and nim = $2;`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentasinya bisa dibenerin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants