Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
Minor improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
connorshea committed Apr 28, 2018
1 parent 748b96a commit eadf10d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/models/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ class Feature < ApplicationRecord
scope "#{browser}_no_data", -> { where("#{browser}": nil) }

# This tries to find all cases where the version_added value is either
# version number or true.
# This code is bad, but it's also probably the best you're gonna get.
# version number or true, since the version_added can only be true, false,
# null, or a version number we can use a regex to elimate all but the
# version numbers.
scope "#{browser}_true", -> {
where("#{browser} ->> :key ~ :regex",
key: "version_added",
Expand Down
12 changes: 11 additions & 1 deletion public/data-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"bare_feature": {
"__compat": {
"support": {
"chrome": {
"firefox": {
"version_added": "1"
}
}
Expand Down Expand Up @@ -65,6 +65,16 @@
}
}
},
"feature_with_alternative_name": {
"__compat": {
"support": {
"firefox": {
"version_added": false,
"alternative_name": "feature_with_firefox_alternative_name"
}
}
}
},
"standard_feature_with_description": {
"__compat": {
"description": "This will be 'Basic support' regardless",
Expand Down

0 comments on commit eadf10d

Please sign in to comment.