File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
mapswipe_workers/mapswipe_workers Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ def transfer_results(project_id_list=None):
2929 # We will only transfer results for projects we in postgres.
3030 postgres_project_ids = get_projects_from_postgres ()
3131
32+ project_id_list_transfered = []
3233 for project_id in project_id_list :
3334 if project_id not in postgres_project_ids :
3435 logger .info (
@@ -49,8 +50,9 @@ def transfer_results(project_id_list=None):
4950 results = results_ref .get ()
5051 del fb_db
5152 transfer_results_for_project (project_id , results )
53+ project_id_list_transfered .appen (project_id )
5254
53- return project_id_list
55+ return project_id_list_transfered
5456
5557
5658def transfer_results_for_project (project_id , results ):
Original file line number Diff line number Diff line change @@ -107,14 +107,28 @@ def run_create_projects():
107107
108108
109109@cli .command ("firebase-to-postgres" )
110- def run_firebase_to_postgres () -> list :
110+ @click .option (
111+ "--project_ids" ,
112+ cls = PythonLiteralOption ,
113+ default = "[]" ,
114+ help = (
115+ "Project ids for which to generate stats as a list of strings: "
116+ """ '["project_a", "project_b"]' """
117+ "(You need the quotes.)"
118+ ),
119+ )
120+ def run_firebase_to_postgres (project_ids : list ) -> list :
111121 """Update users and transfer results from Firebase to Postgres."""
112- project_ids = transfer_results .transfer_results ()
113- for project_id in project_ids :
114- update_data .set_progress_in_firebase (project_id )
115- update_data .set_contributor_count_in_firebase (project_id )
116- send_progress_notification (project_id )
122+ project_ids = transfer_results .transfer_results (project_ids )
123+
124+ if len (project_ids ) > 0 :
125+ for project_id in project_ids :
126+ update_data .set_progress_in_firebase (project_id )
127+ update_data .set_contributor_count_in_firebase (project_id )
128+ send_progress_notification (project_id )
129+
117130 update_data .update_project_data ()
131+
118132 return project_ids
119133
120134
You can’t perform that action at this time.
0 commit comments