Skip to content

Commit 373eb9f

Browse files
authored
Merge branch 'master' into dev
2 parents 8c00e2b + f4babb7 commit 373eb9f

File tree

5 files changed

+26
-199
lines changed

5 files changed

+26
-199
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The MapSwipe Back-End consists of a number of components:
1010
3. Manager Dashboard
1111
5. API
1212

13-
Please refer to the documentation for more information: https://mapswipe-workers.readthedocs.io/en/
13+
Please refer to the documentation for more information: https://mapswipe-workers.readthedocs.io/
1414

1515

1616
## Ressources

postgres/scripts/v1_to_v2/copy_results.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ do
1010
python3 generate_copy_to_csv.py $project_id
1111

1212
echo "Run copy_to_csv.sql using copy_restuls_to_csv.sh (Get all results of this projects from old production database)"
13-
./copy_results_to_csv.sh
13+
./copy_to_csv.sh
1414

1515
echo "Run copy_from_csv.sh to insert all results of this project into new production database"
1616
./copy_from_csv.sh

postgres/scripts/v1_to_v2/copy_results_from_csv.sql

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@
55
/* Goal: assign results based on tasks to a group */
66
/* Problem: there are tasks belonging to 2 different groups */
77

8+
/* Make sure to find out all duplicated tasks beforehand:
9+
/* Create duplicated flag for tasks*/
10+
/* ALTER TABLE*/
11+
/* tasks*/
12+
/* ADD COLUMN*/
13+
/* duplicated boolean DEFAULT false;*/
14+
15+
/* Set duplicated tasks */
16+
/* (tasks with same ID and geometry occurring in two different groups) */
17+
/* UPDATE*/
18+
/* tasks t1*/
19+
/* SET*/
20+
/* duplicated = true*/
21+
/* FROM*/
22+
/* tasks t2*/
23+
/* WHERE*/
24+
/* t1.task_id = t2.task_id*/
25+
/* AND t1.project_id = t2.project_id*/
26+
/* AND t1.group_id != t2.group_id;*/
27+
28+
829
CREATE TEMP TABLE v1_results(
930
project_id varchar,
1031
group_id varchar DEFAULT NULL,
@@ -33,25 +54,6 @@ WHERE result IS NULL;
3354
UPDATE v1_results
3455
SET timestamp = TO_TIMESTAMP(timeint/1000);
3556

36-
/* Create duplicated flag for tasks*/
37-
ALTER TABLE
38-
tasks
39-
ADD COLUMN
40-
duplicated boolean DEFAULT false;
41-
42-
/* Set duplicated tasks */
43-
/* (tasks with same ID and geometry occurring in two different groups) */
44-
UPDATE
45-
tasks t1
46-
SET
47-
duplicated = true
48-
FROM
49-
tasks t2
50-
WHERE
51-
t1.task_id = t2.task_id
52-
AND t1.project_id = t2.project_id
53-
AND t1.group_id != t2.group_id;
54-
5557
/* Set group_id of v1_results for non-duplicated tasks */
5658
UPDATE
5759
v1_results r
@@ -139,9 +141,3 @@ SELECT
139141
FROM
140142
user_results
141143
ON CONFLICT (project_id, group_id, task_id, user_id) DO NOTHING;
142-
143-
144-
ALTER TABLE
145-
tasks
146-
DROP COLUMN
147-
duplicated;

postgres/scripts/v1_to_v2/copy_to_csv.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
USER=mapswipe-workers
55
NAME=mapswipe
66
7+
PGPASSWORD=yourpass
78

89
# Create a ssh tunnel in the background and save PID
910
ssh -Cfo ExitOnForwardFailure=yes -NL 1111:localhost:5432 ${SSH_REMOTE_HOST}
1011
PID=$(pgrep -f 'NL 1111:')
1112

12-
psql -p 1111 -h localhost -U ${USER} -d ${NAME} -a -f copy_to_csv.sql
13-
psql -p 1111 -h localhost -U ${USER} -d ${NAME} -a -f copy_results_to_csv.sql
13+
PGPASSWORD=$PGPASSWORD psql -p 1111 -h localhost -U ${USER} -d ${NAME} -a -f copy_to_csv.sql
14+
PGPASSWORD=$PGPASSWORD psql -p 1111 -h localhost -U ${USER} -d ${NAME} -a -f copy_results_to_csv.sql
1415

1516
kill ${PID}

postgres/scripts/v1_to_v2/notes.md

Lines changed: 0 additions & 170 deletions
This file was deleted.

0 commit comments

Comments
 (0)