Amendment of spec: Templates shall utilize only lower-case variable names

Removal of workaround for lowercase column names
Apropriately changed the test.html
This commit is contained in:
Tina_Azure 2023-03-21 02:05:32 +01:00
parent aea7bebbb5
commit fae75e65fc
3 changed files with 14 additions and 21 deletions

View File

@ -96,7 +96,8 @@ TODO: Figure out what to do for this.
# HTML Templates
HTML Templates are the raw HTML that is used, and filled in, by variable data provided by the system. Templates should be wrote and saved on the file system of the hosting computer, and loaded upon start up. These loaded templates should be filled in with data provided by the system, then the assembled HTML should be given as a response to users.
HTML Templates are the raw HTML that is used, and filled in, by variable data provided by the system. Templates should be wrote and saved on the file system of the hosting computer, and loaded upon start up. These loaded templates should be filled in with data provided by the system, then the assembled HTML should be given as a response to users.
The Templates should utilize purely lower-case variable names.
# Payment Verification

View File

@ -2,7 +2,6 @@
#include <list>
#include <iostream>
#include <pqxx/pqxx>
#include <boost/algorithm/string.hpp>
#include "crow.h"
@ -21,7 +20,7 @@ namespace Database {
* Case for boolean return values because the default return value is f/t instead of 0/1 or false/true
*/
const static std::string PREPARED_STATEMENT_SELECT_ITEM_BY_ID = "selectItemByID";
const static std::string SQL_STATEMENT_SELECT_ITEM_BY_ID = "SELECT id , customerEmailAddress, freelancer, templateName, currencyPreference, priceUpFront, priceOnDeliver, requestDescription, (CASE WHEN requests.accepted THEN 1 ELSE 0 END) AS accepted, upFrontInvoiceID, onDeliverInvoiceID, (CASE WHEN requests.upFrontPaid THEN 1 ELSE 0 END) AS upFrontPaid, (CASE WHEN requests.onDeliverPaid THEN 1 ELSE 0 END) AS onDeliverPaid FROM requests WHERE id=$1;";
const static std::string SQL_STATEMENT_SELECT_ITEM_BY_ID = "SELECT id , customerEmailAddress, freelancer, templateName, currencyPreference, priceUpFront, priceOnDeliver, requestDescription, (CASE WHEN requests.accepted THEN 1 ELSE 0 END) AS accepted, upFrontInvoiceID, onDeliverInvoiceID, (CASE WHEN requests.upFrontPaid THEN 1 ELSE 0 END) AS upFrontPaid, (CASE WHEN requests.onDeliverPaid THEN 1 ELSE 0 END) AS onDeliverPaid FROM requests WHERE id=$1;";
/*
* Struct Representing an item in Requests
@ -109,14 +108,7 @@ namespace Database {
crow::json::wvalue convertResultRowToJSON(pqxx::result &result, int row = 0){
crow::json::wvalue returnJson;
for (int i = 0; i < result.columns(); ++i) {
std::string realColName = result.column_name(i);
for (std::string columnNameReal: JSON_ITEM_NAMES) {
if (boost::algorithm::to_lower_copy(columnNameReal) == realColName) {
realColName = columnNameReal;
break;
}
}
returnJson[realColName] = result.at(row).at(i).c_str();
returnJson[result.column_name(i)] = result.at(row).at(i).c_str();
}
return returnJson;
}

View File

@ -1,13 +1,13 @@
<p>id: {{id}}</p>
<p>customerEmailAddress: {{customerEmailAddress}}</p>
<p>customerEmailAddress: {{customeremailaddress}}</p>
<p>freelancer: {{freelancer}}</p>
<p>templateName: {{templateName}}</p>
<p>currencyPreference: {{currencyPreference}}</p>
<p>priceUpFront: {{priceUpFront}}</p>
<p>priceOnDeliver: {{priceOnDeliver}}</p>
<p>requestDescription: {{requestDescription}}</p>
<p>upFrontInvoiceID: {{upFrontInvoiceID}}</p>
<p>onDeliverInvoiceID: {{onDeliverInvoiceID}}</p>
<p>upFrontPaid: {{upFrontPaid}}</p>
<p>onDeliverPaid: {{onDeliverPaid}}</p>
<p>templateName: {{templatename}}</p>
<p>currencyPreference: {{currencypreference}}</p>
<p>priceUpFront: {{priceupfront}}</p>
<p>priceOnDeliver: {{priceondeliver}}</p>
<p>requestDescription: {{requestdescription}}</p>
<p>upFrontInvoiceID: {{upfrontinvoiceid}}</p>
<p>onDeliverInvoiceID: {{ondeliverinvoiceid}}</p>
<p>upFrontPaid: {{upfrontpaid}}</p>
<p>onDeliverPaid: {{ondeliverpaid}}</p>
<p>accepted: {{accepted}}</p>