From 484525e283262b3b8a7a983d31c0fbae66ae5483 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sat, 3 Feb 2024 10:01:31 -0500 Subject: [PATCH] assign individual --- wrenchboard/src/shared_tool/jobs.cc | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/wrenchboard/src/shared_tool/jobs.cc b/wrenchboard/src/shared_tool/jobs.cc index f170be28..19dabe24 100644 --- a/wrenchboard/src/shared_tool/jobs.cc +++ b/wrenchboard/src/shared_tool/jobs.cc @@ -1375,23 +1375,7 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { long offer_id = 0; out = in; - /* - CREATE TABLE members_jobs_offer ( - id SERIAL, - offer_code varchar(15) UNIQUE NOT NULL, - member_id INT REFERENCES members(id), - client_id INT DEFAULT 0, - group_id INT DEFAULT 0, - job_id INT REFERENCES members_jobs(id), - email varchar(50), - job_description varchar(500), - status integer DEFAULT 1, - sent_count integer DEFAULT 0, - added timestamp without time zone DEFAULT now() - ); - - */ in["client_id"] = "0"; CVars x; CVars y; @@ -1400,19 +1384,18 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { try { // let us use this email to see if this alredy a user on the system - - if (load_db_record(out, " SELECT id AS client_id FROM members WHERE username ='%s'", in["email"].c_str())) { + if (load_db_record(out, " SELECT id AS client_id FROM members WHERE LOWER('username') =LOWER('%s')", in["email"].c_str())) { in["client_id"] = out["client_id"]; // overiddind if account is found if (out["client_id"].length() > 0) { x["client_id"] = in["client_id"]; x["client_id"].set_valid(true); } } - // we need this job id if (load_db_record(y, " SELECT * FROM members_jobs WHERE id =%lu", in["job_id"].Long())) { // valid load of job needed } else { + out["status_msg"] = "Job not found"; out["status"] = "Unable to create offer"; return ret; } @@ -1423,12 +1406,14 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { logfmt(logINFO, " The wallet_id = %lu", wallet_id); if (in["client_id"].Long() == in["member_id"].Long()) { + out["status_msg"] = "You cannot send job to yourself"; out["status"] = "Unable to create offer"; return ret; } // same client and member not allowed if (y["price"].Long() > 0) { } else { + out["status_msg"] = "Price cannot be zero"; out["status"] = "Unable to create offer"; return ret; } // no price zero for job on this path @@ -1441,6 +1426,7 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { } else { out["status"] = "Insufficient balance to create this offer"; logfmt(logINFO, "Price2 = %lu Balance = %lu", y["price"].Long(), z["amount"].Long()); + return ret; } @@ -1480,7 +1466,6 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { load_db_record(out, "SELECT *,id AS offer_id FROM members_jobs_offer WHERE id = %lu ", offer_id); out["status"] = "Offer sent to recipient"; recommendation_engine(RECOMMEND_OFFERS , y, out); // trigger the card interaction in apps - CVars xy; if ( load_db_record(xy, "SELECT id AS member_id, uid AS member_uid, 'alert.svg' AS icon " " FROM members WHERE LOWER(username) = LOWER('%s') ",in["email"].c_str()) > 0 ){ @@ -1488,15 +1473,11 @@ long WrenchSendJobsOfferIndividual(CVars in, CVars &out) { xy["msg"].set_valid(true); plan_notification(xy, out); } - - } else { out["error_msg"] = "error_unable_to_create_fund_for_task"; out["status"] = "Unable to create this offer"; } - - } else { out["status"] = "Unable to create offer"; }