-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add laboratory location to instruments pages. #653
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few more points I'd like you to tidy up, and some subjective code-smells that may be beyond the scope of the current work. Use best judgement especially before replicating older not-best-practices.
lib/npg/model/instrument_format.pm
Outdated
|
||
if(!$self->{'current_instruments'}) { | ||
my $pkg = 'npg::model::instrument'; | ||
my $query = qq(SELECT @{[join q(, ), $pkg->fields()]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this query belongs in npg::model::instrument
. Defer to @mgcam on whether it's worth sorting out all this query copy-pasting that predates this PR. I'd favour npg::model::instrument($instrument_format, $lab)
function with SQL construction based on arguments, unless there's something better in the base package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Let's leave this till the very end and assess then. Not sure how much code will need refactoring.
Softer colours are used. Following user evaluation, lab legend is added to the instrument status legend. Code refactored to create a more direct mapping of lab locations to colours and to create a single point for lab names listing.
Refactored the code to remove code repetition as requested by the reviewer. Made the code testable and added unit tests for the new functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this resolves all the issues I have raised. The underlying code has some red flags, but that's out of scope. I especially do not like the encapsulation-busting $pkg invocations.
Add:
Resolves: #634