Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' of github.com:hotosm/tm-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Feb 8, 2024
2 parents 6231466 + 7da8eb5 commit e72e6cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tm_admin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import:
dirs="`find -type d`"; \
for i in $$dirs; do \
if test -e $$i/$$i.yaml; then \
./db/py -v -i localhost/tm4 -o localhost/tm_admin -t $$i; \"; \
./tmdb.py -v -i localhost/tm4 -o localhost/tm_admin -t $$i; \"; \
fi; \
done

Expand Down
10 changes: 4 additions & 6 deletions tm_admin/campaigns/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@
from tm_admin.types_tm import Userrole, Mappinglevel, Teammemberfunctions
import concurrent.futures
from cpuinfo import get_cpu_info
from atpbar import atpbar
from tm_admin.dbsupport import DBSupport
from tm_admin.users.users_class import UsersTable
from osm_rawdata.postgres import uriParser, PostgresClient
from tm_admin.types_tm import Userrole
from alive_progress import alive_bar
from tqdm import tqdm
from codetiming import Timer
import threading
Expand Down Expand Up @@ -93,7 +91,7 @@ def mergeOrganizations(self):
# pbar = tqdm(result)
for cid, value in data.items():
sql = f" UPDATE campaigns SET organizations = ARRAY{str(value)} WHERE id={cid};"
print(sql)
# print(sql)
self.pg.dbcursor.execute(sql)

def mergeProjects(self):
Expand All @@ -114,8 +112,8 @@ def mergeProjects(self):
result = pg.dbcursor.fetchall()
index = 0
data = dict()
# pbar = tqdm(result)
for record in result:
pbar = tqdm(result)
for record in pbar:
entry = record[0] # there's only one item in the input data
if entry['campaign_id'] not in data:
data[entry['campaign_id']] = list()
Expand All @@ -124,7 +122,7 @@ def mergeProjects(self):
# pbar = tqdm(result)
for cid, value in data.items():
sql = f" UPDATE campaigns SET projects = ARRAY{str(value)} WHERE id={cid};"
print(sql)
# print(sql)
self.pg.dbcursor.execute(sql)

def main():
Expand Down

0 comments on commit e72e6cb

Please sign in to comment.