MCPcopy Create free account
hub / github.com/Cawlumm/lyftr / loadSets

Method loadSets

backend/stores/program.go:222–241  ·  view source on GitHub ↗
(programExerciseID int64)

Source from the content-addressed store, hash-verified

220 rows, err := s.db.Query(query, args...)
221 if err != nil {
222 return nil, err
223 }
224 defer rows.Close()
225
226 for rows.Next() {
227 var pid int64
228 var anchorDayID sql.NullInt64
229 var anchorWID sql.NullInt64
230 var anchorStarted sql.NullString
231 var unlinked int
232 if err := rows.Scan(&pid, &anchorDayID, &anchorWID, &anchorStarted, &unlinked); err != nil {
233 return nil, err
234 }
235 idx := workoutIdx[pid]
236 if !anchorDayID.Valid {
237 result[pid] = idx[unlinked%len(idx)]
238 continue
239 }
240 p := progByID[pid]
241 found := false
242 for pos, wi := range idx {
243 if p.Days[wi].ID == anchorDayID.Int64 {
244 result[pid] = idx[(pos+1+unlinked)%len(idx)]

Callers 1

loadExercisesMethod · 0.95

Calls 1

ScanMethod · 0.80

Tested by

no test coverage detected