Skip to content

Commit b5b16c6

Browse files
committed
Remove some debug logging
1 parent caca84e commit b5b16c6

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

assets/pango/movement/movement.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,17 @@ type sequencePosition struct {
251251
}
252252

253253
func updateSimulatedIdxMap(idxMap *map[Movable]int, moved Movable, startingIdx int, targetIdx int) {
254-
slog.Debug("updateSimulatedIdxMap", "entries", idxMap)
255254
for entry, idx := range *idxMap {
256255
if entry == moved {
257256
continue
258257
}
259258

260-
slog.Debug("updateSimulatedIdxMap", "entry", entry, "idx", idx, "startingIdx", startingIdx, "targetIdx", targetIdx)
261259
if startingIdx > targetIdx && idx >= targetIdx {
262260
(*idxMap)[entry] = idx + 1
263261
} else if startingIdx < targetIdx && idx >= startingIdx && idx <= targetIdx {
264262
(*idxMap)[entry] = idx - 1
265263
}
266264
}
267-
slog.Debug("updateSimulatedIdxMap", "entries", idxMap)
268265
}
269266

270267
func OptimizeMovements(existing []Movable, expected []Movable, entries []Movable, actions []MoveAction, position any) []MoveAction {
@@ -277,10 +274,7 @@ func OptimizeMovements(existing []Movable, expected []Movable, entries []Movable
277274
var optimized []MoveAction
278275

279276
switch position.(type) {
280-
case PositionBefore:
281-
slog.Debug("OptimizeMovements()", "position", position, "type", fmt.Sprintf("%T", position))
282-
case PositionAfter:
283-
slog.Debug("OptimizeMovements()", "position", position, "type", fmt.Sprintf("%T", position))
277+
case PositionBefore, PositionAfter:
284278
default:
285279
return actions
286280
}
@@ -298,22 +292,19 @@ func OptimizeMovements(existing []Movable, expected []Movable, entries []Movable
298292
case ActionWhereBottom:
299293
targetIdx = len(simulated) - 1
300294
case ActionWhereBefore:
301-
slog.Debug("OptimizeMovements()", "dest", action.Destination, "destIdx", simulatedIdxMap[action.Destination])
302295
targetIdx = simulatedIdxMap[action.Destination] - 1
303296
case ActionWhereAfter:
304297
targetIdx = simulatedIdxMap[action.Destination] + 1
305298
}
306299

307-
slog.Debug("OptimizeMovements()", "action", action, "currentIdx", currentIdx, "targetIdx", targetIdx)
308300
if targetIdx != currentIdx {
309301
optimized = append(optimized, action)
310302
simulatedIdxMap[action.Movable] = targetIdx
311303
updateSimulatedIdxMap(&simulatedIdxMap, action.Movable, currentIdx, targetIdx)
312304
}
313305
}
314306

315-
slog.Debug("OptimizeMovements()", "optimized", optimized)
316-
307+
slog.Debug("OptimiveMovements()", "optimized", optimized)
317308
return optimized
318309
}
319310

@@ -348,50 +339,35 @@ func GenerateMovements(existing []Movable, expected []Movable, entries []Movable
348339

349340
var movements []MoveAction
350341

351-
var commonStartIdx, commonEndIdx int
352-
if commonLen > 0 {
353-
commonStartIdx = expectedIdxMap[common[0]]
354-
commonEndIdx = expectedIdxMap[common[commonLen-1]]
355-
}
356-
357-
slog.Debug("GenerateMovements()", "expected", expected)
358-
slog.Debug("GenerateMovements()", "existing", existing)
359-
slog.Debug("GenerateMovements()", "common", common, "commonStartIdx", commonStartIdx, "commonEndIdx", commonEndIdx)
360342
var previous Movable
361343
for _, elt := range entries {
362-
slog.Debug("GenerateMovements()", "elt", elt, "existing", existingIdxMap[elt], "expected", expectedIdxMap[elt])
363344
// If existing index for the element matches the expected one, skip it over
364345
if existingIdxMap[elt] == expectedIdxMap[elt] {
365346
continue
366347
}
367348

368349
if expectedIdxMap[elt] == 0 {
369-
slog.Debug("HELP1")
370350
movements = append(movements, MoveAction{
371351
Movable: elt,
372352
Destination: nil,
373353
Where: ActionWhereTop,
374354
})
375355
previous = elt
376356
} else if expectedIdxMap[elt] == len(expectedIdxMap) {
377-
slog.Debug("HELP2")
378357
movements = append(movements, MoveAction{
379358
Movable: elt,
380359
Destination: nil,
381360
Where: ActionWhereBottom,
382361
})
383362
previous = elt
384363
} else if previous != nil {
385-
slog.Debug("HELP3")
386-
387364
movements = append(movements, MoveAction{
388365
Movable: elt,
389366
Destination: previous,
390367
Where: ActionWhereAfter,
391368
})
392369
previous = elt
393370
} else {
394-
slog.Debug("HELP4")
395371
var where ActionWhereType
396372

397373
switch movement {

assets/pango/movement/movement_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ var _ = Describe("Movement", func() {
132132
Expect(moves).To(HaveLen(0))
133133
})
134134
Context("and moved entries are out of order", func() {
135-
FIt("should generate a single command to move B before D", func() {
135+
It("should generate a single command to move B before D", func() {
136136
// A B C D E -> A B C E D
137137
entries := asMovable([]string{"E", "D"})
138138
moves, err := movement.MoveGroup(
@@ -168,7 +168,7 @@ var _ = Describe("Movement", func() {
168168
})
169169
})
170170
Context("and moved entries are out of order", func() {
171-
FIt("should generate a single command to move B before D", func() {
171+
It("should generate a single command to move B before D", func() {
172172
// A B C D E -> A C B D E
173173
entries := asMovable([]string{"C", "B"})
174174
moves, err := movement.MoveGroup(

0 commit comments

Comments
 (0)