Fix commit action on pool review page to send changes

This commit is contained in:
Eli Ribble 2026-03-11 23:53:08 +00:00
parent d0a920b8d9
commit 6e9554d62d
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -14,12 +14,12 @@ import (
nhttp "github.com/Gleipnir-Technology/nidus-sync/http" nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
"github.com/aarondl/opt/omit" "github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull" "github.com/aarondl/opt/omitnull"
"github.com/rs/zerolog/log"
/* /*
"github.com/Gleipnir-Technology/bob/dialect/psql/sm" "github.com/Gleipnir-Technology/bob/dialect/psql/sm"
"github.com/Gleipnir-Technology/nidus-sync/platform/geom" "github.com/Gleipnir-Technology/nidus-sync/platform/geom"
"github.com/aarondl/opt/omit" "github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull" "github.com/aarondl/opt/omitnull"
"github.com/rs/zerolog/log"
"github.com/stephenafamo/scan" "github.com/stephenafamo/scan"
*/) */)
@ -74,6 +74,7 @@ func postReviewPool(ctx context.Context, r *http.Request, org *models.Organizati
return nil, e return nil, e
} }
txn.Commit(ctx) txn.Commit(ctx)
log.Info().Int32("id", review_task.ID).Str("status", req.Status).Msg("committed")
return &createdReviewPool{}, e return &createdReviewPool{}, e
} }
func discardReviewPool(ctx context.Context, txn bob.Tx, user *models.User, req createReviewPool, review_task_pool *models.ReviewTaskPool) *nhttp.ErrorWithStatus { func discardReviewPool(ctx context.Context, txn bob.Tx, user *models.User, req createReviewPool, review_task_pool *models.ReviewTaskPool) *nhttp.ErrorWithStatus {
@ -121,7 +122,7 @@ func commitReviewPool(ctx context.Context, txn bob.Tx, user *models.User, req cr
), psql.Arg(4326), ), psql.Arg(4326),
), ),
), ),
um.Where(psql.Quote("review_task_pool", "id").EQ(psql.Arg(review_task_pool.ReviewTaskID))), um.Where(psql.Quote("review_task_pool", "review_task_id").EQ(psql.Arg(review_task_pool.ReviewTaskID))),
).Exec(ctx, txn) ).Exec(ctx, txn)
if err != nil { if err != nil {
return nhttp.NewError("save task: %w", err) return nhttp.NewError("save task: %w", err)

View file

@ -206,12 +206,12 @@
try { try {
const payload = { const payload = {
task_id: this.selectedTask.id, task_id: this.selectedTask.id,
status: action, // 'reviewed' or 'discarded' status: action, // 'committed' or 'discarded'
updates: {}, updates: {},
}; };
// Include changed fields in the payload // Include changed fields in the payload
if (action === "reviewed") { if (action === "committed") {
Object.keys(this.form).forEach((key) => { Object.keys(this.form).forEach((key) => {
if (this.form[key] !== this.originalValues[key]) { if (this.form[key] !== this.originalValues[key]) {
payload.updates[key] = this.form[key]; payload.updates[key] = this.form[key];