Date: Sat, 2 Apr 2022 14:43:21 +0800
Subject: [PATCH 19/43] nter
---
app/templates/app/pending.html | 4 ++--
app/views.py | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/templates/app/pending.html b/app/templates/app/pending.html
index 03dd2e706..7c0442801 100644
--- a/app/templates/app/pending.html
+++ b/app/templates/app/pending.html
@@ -13,8 +13,8 @@ Pending Offers
{{ offer_user.0 }}
{{ offer_user.1 }}
- View Offer |
- View User
+ View Offer |
+ View User
|
diff --git a/app/views.py b/app/views.py
index 9be3cde8e..26e4cae76 100644
--- a/app/views.py
+++ b/app/views.py
@@ -112,9 +112,9 @@ def view_user(request, i_user):
with connection.cursor() as cursor:
cursor.execute("SELECT * FROM portfolio WHERE username = %s", [i_user])
interested_user = cursor.fetchone()
- result_dict = {'interested_user': interested_user}
+ result_dict2 = {'interested_user': interested_user}
- return render(request,'app/view_user.html',result_dict)
+ return render(request,'app/view_user.html',result_dict2)
def view_offer(request, offerid):
"""Shows the main page"""
@@ -123,6 +123,6 @@ def view_offer(request, offerid):
with connection.cursor() as cursor:
cursor.execute("SELECT * FROM joboffer WHERE offerid = %s", [offerid])
offers = cursor.fetchone()
- result_dict = {'offer': offers}
+ result_dict1 = {'offer': offers}
- return render(request,'app/view_offer.html',result_dict)
+ return render(request,'app/view_offer.html',result_dict1)
From 27b1da32736ea1823e564c0f68390129ebef18ef Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 14:52:25 +0800
Subject: [PATCH 20/43] Enter
---
app/templates/app/pending.html | 2 +-
app/views.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/templates/app/pending.html b/app/templates/app/pending.html
index 7c0442801..d1ce5e784 100644
--- a/app/templates/app/pending.html
+++ b/app/templates/app/pending.html
@@ -10,7 +10,7 @@ Pending Offers
{% for offer_user in records %}
- {{ offer_user.0 }}
+ {{ helloworld }}
{{ offer_user.1 }}
View Offer |
diff --git a/app/views.py b/app/views.py
index 26e4cae76..e49c645aa 100644
--- a/app/views.py
+++ b/app/views.py
@@ -101,8 +101,9 @@ def pending(request):
pending_offers = cursor.fetchall()
result_dict = {'records': pending_offers}
+ helloworld = {"hello" : "world"}
- return render(request,'app/pending.html',result_dict)
+ return render(request,'app/pending.html',result_dict, helloworld)
# Create your view_user here.
def view_user(request, i_user):
From 5a81d596ac4a03ac6a2d97ee75d0f0c238f7bf54 Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 14:57:56 +0800
Subject: [PATCH 21/43] Enter
---
.vscode/launch.json | 1 +
app/views.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 622975385..9dbe9aa3c 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
+
{
"type": "pwa-chrome",
"request": "launch",
diff --git a/app/views.py b/app/views.py
index e49c645aa..f1d91b52c 100644
--- a/app/views.py
+++ b/app/views.py
@@ -92,7 +92,7 @@ def edit(request, id):
# Create your views here.
-def pending(request):
+def pending(request, *args, **kwargs):
"""Shows the pending page"""
## Use raw query to get all objects
From 386dac77af3e6ec107b619b1b9c8adeed4ea3dbb Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 15:32:09 +0800
Subject: [PATCH 22/43] Enter
---
.vscode/launch.json | 2 +-
add_sql.sh | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 9dbe9aa3c..ae56c489a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -4,7 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
-
+
{
"type": "pwa-chrome",
"request": "launch",
diff --git a/add_sql.sh b/add_sql.sh
index 2304183ff..35273aba7 100755
--- a/add_sql.sh
+++ b/add_sql.sh
@@ -33,3 +33,9 @@ psql ${URI} -f sql/AppStoreSchema.sql
psql ${URI} -f sql/AppStoreCustomers.sql
psql ${URI} -f sql/AppStoreGames.sql
psql ${URI} -f sql/AppStoreDownloads.sql
+psql ${URI} -f sql/PetsittingSchema.sql
+psql ${URI} -f sql/Petsittingjoboffer.sql
+psql ${URI} -f sql/Petsittingpending.sql
+psql ${URI} -f sql/Petsittingpet.sql
+psql ${URI} -f sql/Petsittingportfolio.sql
+psql ${URI} -f sql/Petsittingtransaction.sql
\ No newline at end of file
From eca922d429ed120bafe390124a0b1d56b4c76e81 Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 15:45:44 +0800
Subject: [PATCH 23/43] Enter
---
add_sql.sh | 10 +++++-----
app/templates/app/pending.html | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/add_sql.sh b/add_sql.sh
index 35273aba7..33de6467f 100755
--- a/add_sql.sh
+++ b/add_sql.sh
@@ -1,9 +1,9 @@
# Construct the URI from the .env
-DB_HOST=''
-DB_NAME=''
-DB_USER=''
-DB_PORT=''
-DB_PASSWORD=''
+DB_HOST='localhost'
+DB_NAME='prosgres'
+DB_USER='postgrs'
+DB_PORT='5432'
+DB_PASSWORD='baboon13'
while IFS= read -r line
do
diff --git a/app/templates/app/pending.html b/app/templates/app/pending.html
index d1ce5e784..166db7fb5 100644
--- a/app/templates/app/pending.html
+++ b/app/templates/app/pending.html
@@ -10,7 +10,7 @@ Pending Offers
{% for offer_user in records %}
- {{ helloworld }}
+ {{helloworld}}
{{ offer_user.1 }}
View Offer |
From 7c7e0a6e62bb62678b8799bf3a99e8edad331a98 Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 18:03:18 +0800
Subject: [PATCH 24/43] Enter
---
.env | 4 ++--
AppStore/urls.py | 2 +-
app/views.py | 5 ++---
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/.env b/.env
index a30fada30..0daba83a1 100644
--- a/.env
+++ b/.env
@@ -8,10 +8,10 @@ DEBUG = True
RUN_LOCAL_DB = True
##### Local database ######
-LOCAL_DB_NAME='appstore'
+LOCAL_DB_NAME='petsitting'
LOCAL_DB_USER='postgres'
# Leave the below empty if you haven't set up a local password
-LOCAL_DB_PASSWORD='postgres'
+LOCAL_DB_PASSWORD='baboon13'
##### Heroku database ######
DB_HOST='ec2-3-212-45-192.compute-1.amazonaws.com'
diff --git a/AppStore/urls.py b/AppStore/urls.py
index f531b69b7..9ebbaaff3 100644
--- a/AppStore/urls.py
+++ b/AppStore/urls.py
@@ -25,5 +25,5 @@
path('add', app.views.add, name='add'),
path('view/', app.views.view, name='view'),
path('edit/', app.views.edit, name='edit'),
- path('pending/', app.views.pending)
+ path('pending/', app.views.pending, name='pending')
]
diff --git a/app/views.py b/app/views.py
index f1d91b52c..6d9be2c33 100644
--- a/app/views.py
+++ b/app/views.py
@@ -97,13 +97,12 @@ def pending(request, *args, **kwargs):
## Use raw query to get all objects
with connection.cursor() as cursor:
- cursor.execute("SELECT * FROM pending WHERE username = 'Johnny123'")
+ cursor.execute("SELECT * FROM pending")
pending_offers = cursor.fetchall()
result_dict = {'records': pending_offers}
- helloworld = {"hello" : "world"}
- return render(request,'app/pending.html',result_dict, helloworld)
+ return render(request,'app/pending.html',result_dict)
# Create your view_user here.
def view_user(request, i_user):
From 24bec5f70f2aec045f14eb21242dd8a02023f784 Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sat, 2 Apr 2022 18:03:47 +0800
Subject: [PATCH 25/43] Enter
---
app/templates/app/pending.html | 7 ++-----
sql/PetSittingSchema.sql | 1 +
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/app/templates/app/pending.html b/app/templates/app/pending.html
index 166db7fb5..5b270109d 100644
--- a/app/templates/app/pending.html
+++ b/app/templates/app/pending.html
@@ -13,11 +13,8 @@ Pending Offers
{{helloworld}}
{{ offer_user.1 }}
- View Offer |
- View User
- |
-
-
+ View Offer |
+ View User
{% endfor %}
diff --git a/sql/PetSittingSchema.sql b/sql/PetSittingSchema.sql
index bec92cdee..0788e59e4 100644
--- a/sql/PetSittingSchema.sql
+++ b/sql/PetSittingSchema.sql
@@ -42,6 +42,7 @@ CHECK (rating >= 0 AND rating <= 5)
);
CREATE TABLE IF NOT EXISTS pending (
+username VARCHAR(256) REFERENCES portfolio(username) DEFERRABL
offerid VARCHAR(32) REFERENCES joboffer(offerid) DEFERRABLE,
username VARCHAR(256) REFERENCES portfolio(username) DEFERRABLE
);
From 1ab7dd2d621a5303b1b74d6050bce0b1a4b27cb3 Mon Sep 17 00:00:00 2001
From: Jonas Lim
Date: Sun, 3 Apr 2022 14:32:32 +0800
Subject: [PATCH 26/43] Enter
---
.vscode/settings.json | 5 +++++
app/templates/app/pending.html | 12 ++++++------
app/views.py | 4 ++--
3 files changed, 13 insertions(+), 8 deletions(-)
create mode 100644 .vscode/settings.json
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 000000000..c48c3a243
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "files.associations": {
+ "\"python.pythonPath\"": "\"Your_venv_path/bin/python\""
+ }
+}
\ No newline at end of file
diff --git a/app/templates/app/pending.html b/app/templates/app/pending.html
index 5b270109d..e2ad67c0a 100644
--- a/app/templates/app/pending.html
+++ b/app/templates/app/pending.html
@@ -8,14 +8,14 @@ Pending Offers
Interested User
Action
- {% for offer_user in records %}
+ {% for pending_offers in pending_records %}
- {{helloworld}}
- {{ offer_user.1 }}
+ {{ pending_offers.0 }}
+ {{ pending_offers.1 }}
- View Offer |
- View User
-
+ View Offer |
+ View User
+
{% endfor %}