func (s *Application) FallbackCoordinator(tx *gorm.DB, actor Actor, b BindingRecord) (BindingRecord, error) {
9
// Never move an admitted turn to another account while it may still run.
10
var active int64
11
if b.ID != "" {
12
if err := tx.Table("coordinator_turns t").Where("t.binding_id=? AND t.attempt_id IN (SELECT id FROM attempts WHERE containment='pending')", b.ID).Count(&active).Error; err != nil {
13
return b, err
14
}
15
if active > 0 {
16
return b, nil
17
}
18
}
19
if b.ID != "" {
20
if err := s.loginNotes(tx, actor, b); err != nil {