forked from seek4science/seek
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into digital-research-hub
- Loading branch information
Showing
52 changed files
with
757 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
class AssayClass < ApplicationRecord | ||
|
||
#this returns an instance of AssayClass according to one of the types "experimental" or "modelling" | ||
#if there is not a match nil is returned | ||
def self.for_type type | ||
keys={"experimental"=>"EXP","modelling"=>"MODEL"} | ||
return AssayClass.find_by(key: keys[type]) | ||
# this returns an instance of AssayClass according to one of the constants defined in seek/isa/assay_class.rb | ||
# if there is not a match nil is returned | ||
def self.for_type(type) | ||
AssayClass.find_by(key: type) | ||
end | ||
|
||
def self.experimental | ||
self.for_type('experimental') | ||
for_type('EXP') | ||
end | ||
|
||
def self.modelling | ||
self.for_type('modelling') | ||
for_type('MODEL') | ||
|
||
end | ||
|
||
def self.assay_stream | ||
for_type('STREAM') | ||
end | ||
|
||
def is_modelling? | ||
key == "MODEL" | ||
key == 'MODEL' | ||
end | ||
|
||
def is_experimental? | ||
key == 'EXP' | ||
end | ||
|
||
def is_assay_stream? | ||
key == 'STREAM' | ||
end | ||
|
||
LONG_KEYS = { 'EXP': 'Experimental Assay', 'MODEL': 'Modelling Analysis', 'STREAM': 'Assay Stream' }.freeze | ||
|
||
# for cases where a longer more descriptive key is useful, but can't rely on the title | ||
# which may have been changed over time | ||
def long_key | ||
{'EXP'=>'Experimental Assay','MODEL'=>'Modelling Analysis'}[key] | ||
LONG_KEYS[key.to_sym] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.