Skip to content

Commit

Permalink
code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKuchin committed Apr 21, 2022
1 parent 03559c1 commit 694b986
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/pd/utilities_timecard3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,10 @@ static auto __GetBTList(const string &sow_where_statement, const string &sow_lim
auto sow_ids = GetValuesFromDB(sow_statement, db);

return
"\"sow\":[" + (sow_ids.size() ? GetSOWInJSONFormat("SELECT * FROM `contracts_sow` WHERE `id` IN (" + join(sow_ids, ",") + ");", db, user, true, false, false, true)
"\"sow\":[" + (sow_ids.size() ? GetSOWInJSONFormat("SELECT * FROM `contracts_sow` WHERE `id` IN (" + join(sow_ids, ",") + ");", db, user, true, false, false, true)
: "")
+ "],"
"\"bt\":[" + (sow_ids.size() ? GetBTsInJSONFormat(
"\"bt\":[" + (sow_ids.size() ? GetBTsInJSONFormat(
"SELECT * FROM `bt` WHERE "
"`contract_sow_id` IN (" + join(sow_ids, ",") + ")"
+ bt_where_statement +
Expand Down Expand Up @@ -797,15 +797,20 @@ static auto __GetTimecardList(const string &sow_where_statement, const string &s
auto sow_ids = GetValuesFromDB(sow_statement, db);

return
"\"sow\":[" + (sow_ids.size() ? GetSOWInJSONFormat("SELECT * FROM `contracts_sow` WHERE `id` IN (" + join(sow_ids, ",") + ");", db, user, false, false, false, true) : "") + "],"
"\"timecards\":[" + (sow_ids.size() ?
GetTimecardsInJSONFormat(
"SELECT * FROM `timecards` WHERE "
"`contract_sow_id` IN (" + join(sow_ids, ",") + ")"
+ timecard_where_statement +
";", db, user)
: "") + "],"
"\"holiday_calendar\":[" + (sow_ids.size() ? GetHolidayCalendarInJSONFormat("SELECT * FROM `holiday_calendar` WHERE `agency_company_id` IN (SELECT `agency_company_id` FROM `contracts_sow` WHERE " + sow_where_statement + ");", db, user) : "") + "]"
"\"sow\":[" + (sow_ids.size() ? GetSOWInJSONFormat("SELECT * FROM `contracts_sow` WHERE `id` IN (" + join(sow_ids, ",") + ");", db, user, false, false, false, true)
: "")
+ "],"
"\"timecards\":[" + (sow_ids.size() ?
GetTimecardsInJSONFormat(
"SELECT * FROM `timecards` WHERE "
"`contract_sow_id` IN (" + join(sow_ids, ",") + ")"
+ timecard_where_statement +
";", db, user)
: "")
+ "],"
"\"holiday_calendar\":[" + (sow_ids.size() ? GetHolidayCalendarInJSONFormat("SELECT * FROM `holiday_calendar` WHERE `agency_company_id` IN (SELECT `agency_company_id` FROM `contracts_sow` WHERE " + sow_where_statement + ");", db, user)
: "")
+ "]"
;
}

Expand Down

0 comments on commit 694b986

Please sign in to comment.