From 1022466ce0979380a2c304e829ec7364dbd0e465 Mon Sep 17 00:00:00 2001
From: David LeBauer
Date: Fri, 2 Nov 2018 09:11:20 -0700
Subject: [PATCH 01/17] Update .zenodo.json
trying to fix errors w/ zenodo; 'metadata' level is not required
---
.zenodo.json | 126 +++++++++++++++++++++++++--------------------------
1 file changed, 62 insertions(+), 64 deletions(-)
diff --git a/.zenodo.json b/.zenodo.json
index 2c7a9cfb1..5461022f4 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -1,69 +1,67 @@
{
- "metadata": {
- "access_right": "open",
- "creators": [{
- "affiliation": "University of Illinois",
- "name": "Scott Rohde"
- },
- {
- "name": "Carl Crott"
- },
- {
- "affiliation": "University of Illinois",
- "name": "David LeBauer"
- },
- {
- "name": "Patrick Mulrooney"
- },
- {
- "affiliation": "National Center for Supercomputing Applications",
- "name": "Rob Kooper"
- },
- {
- "name": "Jeremy Kemball"
- },
- {
- "name": "Jimmy Chen"
- },
- {
- "name": "Andrew Shirk"
- },
- {
- "name": "Zhengqi Yang"
- },
- {
- "affiliation": "National Center for Supercomputing Applications",
- "name": "Max Burnette"
- },
- {
- "name": "Haotian Jiang"
- },
- {
- "name": "Yilin Dong"
- },
- {
- "name": "Uday Saraf"
- },
- {
- "affiliation": "Boston University",
- "name": "Michael Dietze"
- },
- {
- "name": "Chris Black"
- }
- ],
- "language": "eng",
- "license": {
- "id": "NCSA"
+ "access_right": "open",
+ "creators": [{
+ "affiliation": "University of Illinois",
+ "name": "Scott Rohde"
},
- "references": [
- "LeBauer, D., Kooper, R., Mulrooney, P., Rohde, S., Wang, D., Long, S. P., & Dietze, M. C. (2018). BETYdb: a yield, trait, and ecosystem service database applied to second\u2010generation bioenergy feedstock production. GCB Bioenergy, 10(1), 61-71",
- "LeBauer, David, Michael Dietze, Rob Kooper, Steven Long, Patrick Mulrooney, Gareth Scott Rohde, Dan Wang (2010). Biofuel Ecophysiological Traits and Yields Database (BETYdb), Energy Biosciences Institute, University of Illinois at Urbana-Champaign. doi:10.13012/J8H41PB9"
- ],
- "notes": "Development of BETYdb is supported by the National Science Foundation (ABI #1062547, ABI #1458021), the Department of Energy (ARPA-E awards #DE-AR0000594 and DE-AR0000598), and the Energy Biosciences Institute.",
- "resource_type": {
- "title": "Software",
- "type": "software"
+ {
+ "name": "Carl Crott"
+ },
+ {
+ "affiliation": "University of Illinois",
+ "name": "David LeBauer"
+ },
+ {
+ "name": "Patrick Mulrooney"
+ },
+ {
+ "affiliation": "National Center for Supercomputing Applications",
+ "name": "Rob Kooper"
+ },
+ {
+ "name": "Jeremy Kemball"
+ },
+ {
+ "name": "Jimmy Chen"
+ },
+ {
+ "name": "Andrew Shirk"
+ },
+ {
+ "name": "Zhengqi Yang"
+ },
+ {
+ "affiliation": "National Center for Supercomputing Applications",
+ "name": "Max Burnette"
+ },
+ {
+ "name": "Haotian Jiang"
+ },
+ {
+ "name": "Yilin Dong"
+ },
+ {
+ "name": "Uday Saraf"
+ },
+ {
+ "affiliation": "Boston University",
+ "name": "Michael Dietze"
+ },
+ {
+ "name": "Chris Black"
}
+ ],
+ "language": "eng",
+ "license": {
+ "id": "NCSA"
+ },
+ "references": [
+ "LeBauer, D., Kooper, R., Mulrooney, P., Rohde, S., Wang, D., Long, S. P., & Dietze, M. C. (2018). BETYdb: a yield, trait, and ecosystem service database applied to second\u2010generation bioenergy feedstock production. GCB Bioenergy, 10(1), 61-71",
+ "LeBauer, David, Michael Dietze, Rob Kooper, Steven Long, Patrick Mulrooney, Gareth Scott Rohde, Dan Wang (2010). Biofuel Ecophysiological Traits and Yields Database (BETYdb), Energy Biosciences Institute, University of Illinois at Urbana-Champaign. doi:10.13012/J8H41PB9"
+ ],
+ "notes": "Development of BETYdb is supported by the National Science Foundation (ABI #1062547, ABI #1458021), the Department of Energy (ARPA-E awards #DE-AR0000594 and DE-AR0000598), and the Energy Biosciences Institute.",
+ "resource_type": {
+ "title": "Software",
+ "type": "software"
}
}
From 64b9a5a2eeef66f470a1bb8ab1a92d2c1808ac75 Mon Sep 17 00:00:00 2001
From: David LeBauer
Date: Fri, 2 Nov 2018 09:13:27 -0700
Subject: [PATCH 02/17] Update .zenodo.json
---
.zenodo.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.zenodo.json b/.zenodo.json
index 5461022f4..80a703a6f 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -8,7 +8,7 @@
"name": "Carl Crott"
},
{
- "affiliation": "University of Illinois",
+ "affiliation": "University of Arizona",
"name": "David LeBauer"
},
{
From 032f1f09baf6ec0667d4a5acc7abc5516f760125 Mon Sep 17 00:00:00 2001
From: Scott Rohde
Date: Fri, 9 Nov 2018 14:30:05 -0600
Subject: [PATCH 03/17] Comment revisions only.
---
app/models/bulk_upload_data_set.rb | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/models/bulk_upload_data_set.rb b/app/models/bulk_upload_data_set.rb
index f1367c972..17a375a8d 100644
--- a/app/models/bulk_upload_data_set.rb
+++ b/app/models/bulk_upload_data_set.rb
@@ -1242,8 +1242,12 @@ def insert_data
t.site_id = row['site_id']
# Modify each Trait class instance so that date strings are
- # interpreted as being in the time zone of the trait site
- # (or UTC, if the trait site time_zone column is null)
+ # interpreted as being in the time zone of the trait site (or UTC, if
+ # the trait site time_zone column is null). Note that in the Bulk
+ # Upload Wizard, the validation step will prevent reaching this code
+ # if a site without time zone is in the data file. But nothing
+ # prevents a site without time zone from being specified
+ # interactively.
class <
Date: Mon, 26 Nov 2018 15:23:10 -0600
Subject: [PATCH 04/17] Implement feature requested in Issue #605: allow
key-less API access to public data.
---
app/services/api_authentication_system.rb | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/app/services/api_authentication_system.rb b/app/services/api_authentication_system.rb
index c044ee66c..b638f9c68 100644
--- a/app/services/api_authentication_system.rb
+++ b/app/services/api_authentication_system.rb
@@ -3,7 +3,11 @@ module ApiAuthenticationSystem
# Override default access_denied action.
def access_denied
- @errors = "authentication failed"
+ if @errors
+ @errors = "authentication failed: " + @errors
+ else
+ @errors = "authentication failed"
+ end
render status: 401
end
@@ -19,4 +23,21 @@ def permissions(action_name, resource)
end
end
+ # Override "login_from_api_key" so that if no key is given or the given key is
+ # invalid, the user is logged in as the guest user.
+ def login_from_api_key
+ key = params[:key]
+ if key.nil?
+ u = User.find_by_login('guestuser')
+ else
+ u = User.find_by_apikey(params[:key]) || User.find_by_login('guestuser')
+ end
+
+ if u.nil?
+ @errors = "You must either use a valid API key or set up the guest user account."
+ end
+
+ return u
+ end
+
end
From 1510660a69a98f3e8712d1a7fcce2a055ec09980 Mon Sep 17 00:00:00 2001
From: Scott Rohde
Date: Tue, 27 Nov 2018 14:33:35 -0600
Subject: [PATCH 05/17] Consider an invalid API key an error rather than
defaulting to the guest user account.
---
app/services/api_authentication_system.rb | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/app/services/api_authentication_system.rb b/app/services/api_authentication_system.rb
index b638f9c68..afe112cf1 100644
--- a/app/services/api_authentication_system.rb
+++ b/app/services/api_authentication_system.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
module ApiAuthenticationSystem
include AuthenticatedSystem
@@ -28,13 +29,15 @@ def permissions(action_name, resource)
def login_from_api_key
key = params[:key]
if key.nil?
- u = User.find_by_login('guestuser')
+ u = User.find_by_login('guestuserx')
+ if u.nil?
+ @errors = "For key-less access to the API, you must set up the guest user account."
+ end
else
- u = User.find_by_apikey(params[:key]) || User.find_by_login('guestuser')
- end
-
- if u.nil?
- @errors = "You must either use a valid API key or set up the guest user account."
+ u = User.find_by_apikey(params[:key])
+ if u.nil?
+ @errors = "Invalid API key. To access the API as a guest user, omit the “key” parameter."
+ end
end
return u
From d0f8c053b9475ebf14d73fb92dfc21404f7a7b03 Mon Sep 17 00:00:00 2001
From: Scott Rohde
Date: Tue, 27 Nov 2018 14:56:13 -0600
Subject: [PATCH 06/17] Fixed incorrect login string. Got rid of redundant use
of params[:key].
---
app/services/api_authentication_system.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/services/api_authentication_system.rb b/app/services/api_authentication_system.rb
index afe112cf1..a52974068 100644
--- a/app/services/api_authentication_system.rb
+++ b/app/services/api_authentication_system.rb
@@ -29,12 +29,12 @@ def permissions(action_name, resource)
def login_from_api_key
key = params[:key]
if key.nil?
- u = User.find_by_login('guestuserx')
+ u = User.find_by_login('guestuser')
if u.nil?
@errors = "For key-less access to the API, you must set up the guest user account."
end
else
- u = User.find_by_apikey(params[:key])
+ u = User.find_by_apikey(key)
if u.nil?
@errors = "Invalid API key. To access the API as a guest user, omit the “key” parameter."
end
From ca34ddbd6fb997908362ac397cca0be9c43de025 Mon Sep 17 00:00:00 2001
From: Scott Rohde
Date: Tue, 27 Nov 2018 15:20:50 -0600
Subject: [PATCH 07/17] Add maps.js to the precompile list to fix issue 596.
---
config/initializers/assets.rb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 0098a0d6a..0069c2990 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -17,6 +17,8 @@
lazy/feedback.js
lazy/autocomplete.js
lazy/bulk_upload.js
+
+ mylibs/maps.js
)
Rails.application.config.assets.paths <<
From 221b60828caee8099320ddc38dffd258a89d704e Mon Sep 17 00:00:00 2001
From: Scott Rohde
Date: Thu, 29 Nov 2018 15:50:30 -0600
Subject: [PATCH 08/17] Added a "type" attribute to the "Show" and "All
Records" buttons on the covariate editing pages to prevent the default
"submit" action from being attempted. This fixes issue #585. Also removed
an extraneous "Update" button.
Make the "Show" page for covariates give a more user-friendly error message when
the covariate lacks an association with a trait.
---
app/controllers/covariates_controller.rb | 4 ++++
app/views/covariates/edit.html.erb | 7 ++-----
app/views/covariates/show.html.erb | 2 ++
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/controllers/covariates_controller.rb b/app/controllers/covariates_controller.rb
index 7ef6845ec..f7132903a 100644
--- a/app/controllers/covariates_controller.rb
+++ b/app/controllers/covariates_controller.rb
@@ -31,6 +31,10 @@ def index
def show
@covariate = Covariate.find(params[:id])
+ if @covariate.trait.nil?
+ flash[:error] = 'This covariated is not associated with a trait! Consider removing it.'
+ end
+
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @covariate }
diff --git a/app/views/covariates/edit.html.erb b/app/views/covariates/edit.html.erb
index 66db0423a..ea46ea795 100644
--- a/app/views/covariates/edit.html.erb
+++ b/app/views/covariates/edit.html.erb
@@ -44,17 +44,14 @@
<%= f.label :statname %>
<%= f.select :statname, $statname_list %>
-
- <%= f.submit 'Update' %>
-