mitchell852 closed pull request #1910: fix ds request status change sql
URL: https://github.com/apache/incubator-trafficcontrol/pull/1910
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/traffic_ops/testing/api/v13/deliveryservice_requests_test.go 
b/traffic_ops/testing/api/v13/deliveryservice_requests_test.go
index b9301ae178..193f03c6c9 100644
--- a/traffic_ops/testing/api/v13/deliveryservice_requests_test.go
+++ b/traffic_ops/testing/api/v13/deliveryservice_requests_test.go
@@ -134,7 +134,7 @@ func TestDeliveryServiceRequestBad(t *testing.T) {
                t.Errorf("Error creating DeliveryServiceRequest %v", err)
        }
        expected := []string{
-               `invalid initial request status pending.  Must be 'draft' or 
'submitted'`,
+               `'status' invalid transition from draft to pending`,
        }
        utils.Compare(t, expected, alerts.ToStrings())
 }
diff --git a/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
index aff46781bd..8cbbafc8b1 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/request/requests.go
@@ -538,7 +538,7 @@ func (req *deliveryServiceRequestAssignment) Update(db 
*sqlx.DB, user auth.Curre
        if req.AssigneeID != nil {
                v = strconv.Itoa(*req.AssigneeID)
        }
-       query := fmt.Sprintf(`UPDATE deliveryservice_request SET assignee_id = 
%s WHERE id=%d`, v, req.ID)
+       query := `UPDATE deliveryservice_request SET assignee_id = ` + v + ` 
WHERE id=` + strconv.Itoa(*req.ID)
        _, err = tx.Exec(query)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {
@@ -632,7 +632,7 @@ func (req *deliveryServiceRequestStatus) Update(db 
*sqlx.DB, user auth.CurrentUs
        }
 
        // LastEditedBy field should not change with status update
-       query := fmt.Sprintf(`UPDATE deliveryservice_request SET status = '%v' 
WHERE id=%d`, req.Status, req.ID)
+       query := `UPDATE deliveryservice_request SET status = '` + 
string(*req.Status) + `' WHERE id=` + strconv.Itoa(*req.ID)
        _, err = tx.Exec(query)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to