fix: Upload to HRDLog
This commit is contained in:
@@ -625,6 +625,29 @@ func (r *Repo) MarkLoTWUploaded(ctx context.Context, id int64, date string) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarkUploadedBatch sets <statusCol>='Y' and <dateCol>=date on EVERY id in one
|
||||
// UPDATE — used by bulk upload (Club Log / HRDLog) so a 25k-QSO run isn't one
|
||||
// round-trip per QSO on a remote MySQL. statusCol/dateCol come from a fixed
|
||||
// whitelist (not user input), so the column interpolation is safe.
|
||||
func (r *Repo) MarkUploadedBatch(ctx context.Context, statusCol, dateCol, date string, ids []int64) error {
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
ph := strings.TrimSuffix(strings.Repeat("?,", len(ids)), ",")
|
||||
args := make([]any, 0, len(ids)+2)
|
||||
args = append(args, date, db.NowISO())
|
||||
for _, id := range ids {
|
||||
args = append(args, id)
|
||||
}
|
||||
_, err := r.db.ExecContext(ctx,
|
||||
`UPDATE qso SET `+statusCol+` = 'Y', `+dateCol+` = ?, updated_at = ? WHERE id IN (`+ph+`)`,
|
||||
args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("mark uploaded batch (%d): %w", len(ids), err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarkEQSLSent stamps EQSL_QSL_SENT=Y and the sent date after a successful
|
||||
// eQSL e-mail. date is an ADIF YYYYMMDD string.
|
||||
func (r *Repo) MarkEQSLSent(ctx context.Context, id int64, date string) error {
|
||||
|
||||
Reference in New Issue
Block a user