Project

General

Profile

Feature #31147

Updated by Lukas Zapletal over 3 years ago

ConfigReportStatusCalculator class is too tightly coupled with ConfigReport (using MAX and other constants). This needs to be decoupled there is no reason to have it like that, this will also enable using this class in the modernized report engine. 

 Also we currently do not indicate that the maximum number has been reached (e.g. 63 currently for puppet). There should be a helper method that returns numbers as strings returning "63+" in case the ceiling is reached. This should be used in templates to render those number correctly so users can actually recognize this hidden fact. 

 Next up, Finally, status is a "BIG INT" in our database schema which is 64 bits however currently the class does not make use of all bits for some reason: 36 bits are used for some strange reason in Puppet case. This will allow larger numbers. Migration must be done to convert current reports into the wider format. 

 Finally, there is an existing index named index_reports_on_status on the status column, but this is useless - this will never be used since scoped_search use bitwise shift and and operators: https://github.com/wvanbergen/scoped_search/blob/6fe6b86c223d7ba8eb14207bae8f4c28f676d9d0/lib/scoped_search/query_builder.rb#L343 

 In order to use an index, it would have to be a dynamic index on (status >> 8) but this can't be done since it is unknown how many bits are used in each plugin. The index should be simply dropped as unused.

Back