-
Notifications
You must be signed in to change notification settings - Fork 175
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
[Instrument] Make instrument data non-static #6868
Conversation
Should we update this reference too? https://github.com/aces/Loris/blob/main/raisinbread/instruments/NDB_BVL_Instrument_aosi.class.inc#L549 |
Good catch, I missed that one.. updated it. |
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.
Checked and caching system works and instruments load without any issues.
NDB_BVL_Instrument has an.. unusual.. way of dealing with instrument data. Rather than having a class method for getting the data, there's a static method which takes an instrument as a parameter. The result is that data can not be cached in the object and needs to be continuously re-loaded from the database every time if it's needed multiple times in the same request. (For instance, calling getFieldValue for different fields in a script.) This adds a normal getter and caches the results in the object, deprecating the old static loadInstanceData and its inexplicable behaviour.
One last thing! Phan is throwing some errors: test/unittests/NDB_BVL_Instrument_Test.php:1140 PhanDeprecatedFunction Call to deprecated function \NDB_BVL_Instrument::loadInstanceData() defined at php/libraries/NDB_BVL_Instrument.class.inc:2170 (Deprecated because: use $instrumentInstance->getInstanceData() instead) |
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.
Phan errors need to be fixed (see above). NDB_BVL_Instrument_Test.php was added after the PR so a rebase is needed.
bbb0066
to
ae03bb3
Compare
* @return void | ||
*/ | ||
function testLoadInstanceData() | ||
function getLoadInstanceData() |
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.
testGetInstanceData?
One test is failing.
/app/test/unittests/NDB_BVL_Instrument_Test.php:1602 |
Impressive, the tests are running really fast with Github actions. |
I think the individual test suites take about the same amount of time, but they start a lot faster. |
NDB_BVL_Instrument has an.. unusual.. way of dealing with instrument data. Rather than having a class method for getting the data, there's a static method which takes an instrument as a parameter. The result is that data can not be cached in the object and needs to be continuously re-loaded from the database every time if it's needed multiple times in the same request. (For instance, calling getFieldValue for different fields in a script.) This adds a normal getter and caches the results in the object, deprecating the old static loadInstanceData.
NDB_BVL_Instrument has an.. unusual.. way of dealing with instrument
data. Rather than having a class method for getting the data, there's
a static method which takes an instrument as a parameter. The result
is that data can not be cached in the object and needs to be continuously
re-loaded from the database every time if it's needed multiple times in
the same request. (For instance, calling getFieldValue for different fields
in a script.)
This adds a normal getter and caches the results in the object, deprecating
the old static loadInstanceData and its inexplicable behaviour.