Conversation
|
|
||
| const ( | ||
| // Collection queries | ||
| QueryGetNilaiSiswaByID = `select nim, mapel_id, nilai, sekolah, kelas |
There was a problem hiding this comment.
coalescenya jangan lupa yaa, takutnya kalo null bisa geser nanti atributenya
| type NilaiSiswa struct { | ||
| NIM int64 `json:"nim" db:"nim"` | ||
| MapelID int64 `json:"mapel_id" db:"mapel_id"` | ||
| Nilai int64 `json:"nili" db:"nili"` |
There was a problem hiding this comment.
typo yaaa nili
Nilai int64 json:"nili" **db:"nili"**
|
|
||
| resp = mappingGetNilaiSiswa(nilai, detailSekolah) | ||
| } | ||
|
|
There was a problem hiding this comment.
untuk mappingGetNilaiSiswa() dan nilai.GetDetailSekolah(), mungkin bisa dikeluarin dari if nya, karena rada redundan
rakadityas
left a comment
There was a problem hiding this comment.
Unit testnya masih belum ada ya?
| req.sekolah = "semua" | ||
| } | ||
|
|
||
| nilai, err := mnilai.GetNilaiSiswa(req.nim, req.sekolah, req.kelas, mapel_id) |
There was a problem hiding this comment.
btw pak, untuk nama variablenya mungkin bisa distandarin, jangan pakai underscore mapel_id
There was a problem hiding this comment.
hmm mapel_id ini dari mana ya 🤔
| } | ||
|
|
||
| resp = mappingGetNilaiSiswa(nilai, detailSekolah) | ||
| } else if sekolah != "semua" { |
There was a problem hiding this comment.
constant ini sepertinya dipake berulang ulang, mungkin bisa dibuat constant, supaya kalau berubah satu berubah semua
| return resp, errors.AddTrace(err) | ||
| } | ||
|
|
||
| detailSekolah, err := nilai.GetDetailSekolah(ctx, nilai.Sekolah[0]) |
There was a problem hiding this comment.
indexnya sepertinya perlu dicek dulu, takutnya nil
| "github.com/tokopedia/tokopoints/tracer" | ||
| ) | ||
|
|
||
| func GetNilaiSiswa(ctx context.Context, nim int64, sekolah, kelas string, mapel_id int64) (resp GetNilaiSiswaResponse, err error) { |
There was a problem hiding this comment.
mungkin paramnya bisa dibuat struct supaya ga kepanjangan
No description provided.