Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reintroduce detail level system (#943)
* Create infrastructure to configure Entities for different Detail Levels * Introduce ElementDetailLevelCalculator This class reimplements the logic from the ElementPermissionProxy. As the name suggests, it only calculates the detail levels (more efficiently I think). It does explicitly NOT include functionality to serialize elements. This should be done separately (see ApplicationEntity#entity_for_level). * Fix some lint issues * Fix internal datastructure in ElementDetailLevelCalculator * Fix bugs in ElementDetailLevelCalculator * Add expose! method with additional features - anonymize_below: X -> anonymizes the field with a default string if the current detail level of the object is lower than X - anonymize_with: Y -> uses Y as a replacement when a value gets anonymized * Some fixes * Fix usage of with_options * Fix specs * Add specs for calculator and application entity * Use with_options to make SampleEntity a little more readable * Remove analyses field from sample entity as it is not used in the frontend and the anonymization code was broken anyway * Introduce detail levels into WellplateEntity * Introduce detail levels to WellEntity * Fix well entity * Fix anonymization bugs in SampleEntity * Use expose! in WellplateEntity and fix some anonymizations * Use expose! in WellEntity and fix double expose of readouts * Rework ResearchPlanEntity a little, but it does not use anonymization anyway * Introduce detail levels into Screen * Fix syntax bug in ResearchPlanEntity * Fix ElementDetailLevelCalculatorSpec * Remove detail_level method from ElementDetailLevelCalculator As we discussed, we will only use the simpler logic of nested_detail_levels, based on the maximum configured level over all accessible collections. This removes a lot of special cases (that were not required anyway). Further optimization will be possible when the shared and synced collections feature gets merged, so we only have one of those left. * Reintroduce anonymization to ElementAPI * Reintroduce anonymization to SampleAPI * Reintroduce anonymization to ScreenAPI * Reintroduce anonymization to SearchAPI * Reintroduce anonymization to WellplateAPI * Reintroduce anonymization to ResearchPlanAPI * Reintroduce anonymization into ReactionAPI * WIP find a better workflow to test entities * Fix logic bug in ApplicationEntity that made anonymization options within with_options not work properly * Add final spec for sample entity * Add specs for 2 special cases * Add specs for well entity * Add specs for wellplate entity * Fix some linter issues * Fix more rubocop issues * Fix rubocop issues in classes * Add specs for screen entity * Update ResearchPlanEntity * Add anonymization to SampleReportEntity * Refactor LiteratureEntity * Make literatures method in SampleReportEntity private * Fix invocation of ElementDetailLevelCalculator in ReactionAPI * Inntroduce anonymization to ReactionEntity * Add default for detail_levels in ElementDetailLevelCalculator * Fix specs that broke after introducing anonymization * Use expose! in ReactionMaterialEntity * Introduce anonymization and analyses into ReactionMaterialReportEntity * Fix syntax issue in SampleReportEntity * Fix filenames of several spec files * Prevent deprecation warnings about unsafe SQL strings * Fix reporter specs for csv and html * Raise exception when inkscape is not installed * Rework ReactionReportEntity to include anonymization and inheritance from ReactionEntity * Introduce anonymization into ElementEntity * Reintroduce detail levels into GenericElementAPI * Make PurificationSolvents available for DetailLevel0 * Add specs for research plan entity * WIP Add specs for reaction * Make usage of ApplicationEntity#detail_levels less error-prone When no detail levels are configured, 10 is returned for every requested class. When detail levels are configured, every request for an unconfigured class returns 0, configured classes return their respective configuration. This allows us to use simple hashes in our specs, instead of relying on the result of the ElementDetailLevelCalculator. * Unify usage of expose! in ReactionMaterialEntity * Set Reporter::Xlsx::ReactionList spec to pending The spec tries to parse a Xlsx file generated by Axlsx using Roo. The currently used Roo gem has a parser implementation that does not properly understand the valid xml structure Axlsx generates, so the spec fails. The newer version Roo 2.9.0 appears to have addressed this bug but requires Ruby 2.7 to run. Until we complete the Rails 6 Upgrade, this spec is pending * Add reaction entity spec * Add spec for sample report spec * Reintroduce Detail levels to some more codepaths * Fix reaction material Entity to display analyses properly * Remove fcontext and binding.pry * Add ci image with inkscape dependency * Fix ci image again * Add a working ci image * Fix spec * Disable spec with missing dependency Co-authored-by: Johannes Haubold <jh@megorei.com>
- Loading branch information
1 parent
182ef45
commit e12d38a
Showing
55 changed files
with
2,159 additions
and
533 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
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.