From 30327df425ad7284cf51ade8fda077b87a5c71d8 Mon Sep 17 00:00:00 2001 From: Eric Tsai Date: Tue, 24 Sep 2019 15:22:20 +0800 Subject: [PATCH] add view result to environment variable --- README.md | 1 + lib/tasks/sync_ntnu_personal_data_tasks.rake | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a69d298..a5ba2f4 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,6 @@ ENV['NTNU_DB_HOST'] = 'database host' ENV['NTNU_DB_PORT'] = 'database port' ENV['TDS_VERSION'] = '5.0' ENV['DB_NAME'] = 'database name' +ENV['VIEW_RESULT'] = 'database view result' ``` * set cron job to run `bundle exec rake sync_personal_plugins:sync` everyday diff --git a/lib/tasks/sync_ntnu_personal_data_tasks.rake b/lib/tasks/sync_ntnu_personal_data_tasks.rake index 1dcb8cc..29756a5 100644 --- a/lib/tasks/sync_ntnu_personal_data_tasks.rake +++ b/lib/tasks/sync_ntnu_personal_data_tasks.rake @@ -15,7 +15,8 @@ namespace :sync_personal_plugins do end # Query data and store them to local memory - tds_result = sybase_client.execute 'SELECT * FROM VIEW_RESULTS_0001' + view = ENV['VIEW_RESULT'] + tds_result = sybase_client.execute "SELECT * FROM #{view}" query_result = tds_result.entries # Close the NTNU SyBase connection