joomla-projects / j4adminui

Joomla!4 alternative backend template
GNU General Public License v2.0
24 stars 18 forks source link

Available updates percentage #115

Closed brianteeman closed 4 years ago

brianteeman commented 4 years ago

Steps to reproduce the issue

Install something that has available updates eg an older german language file from http://joomlacode.org/gf/project/jtranslation3_x/frs/?action=FrsReleaseBrowse&frs_package_id=6418

Actual result

image

Additional comments

It's pretty but if it is going to just remove 1% for each extension then it is very misleading

ahamed commented 4 years ago

It's actually something 99.99% but we take the floor of the fraction. The total calculation is- If Joomla! is outdated then the 50% of the system is outdated and the other 50% is all of the extensions.

brianteeman commented 4 years ago

so with 10 outdated extensions it produces a value of ?

ahamed commented 4 years ago

The condition is Joomla! alone = 50% + All extensions = 50%. So if 10 extensions are outdated and say there are 120 installed extensions. Then the calculation would be-

total_updated = (120 - 10) = 110 update_percent = (110 * 100) / 120 = 91.67%

50% of update_percent is 91.67 * (50 / 100) = 45.83% // As all extensions = 50% and Joomla! = 50%

IF Joomla! updated then total_percent = 45.83 + 50 = 95.83%, Otherwise it is 45.83%

The floor result is 95% or 45%

brianteeman commented 4 years ago

So the problem is that you are not calculating the number of extensions correctly.

What you are doing is a count of everything in the extensions table

https://github.com/joomla-projects/j4adminui/blob/caa81fca76b54b2a7561f6c69862c56dc8c6e8bd/administrator/modules/mod_extension_updates/Helper/ExtensionUpdatesHelper.php#L153-L163

But that is not correct. You should only be counting the number of non-core extensions not all the extensions. To do this you should be the functions in the ExtensionHelper

ahamed commented 4 years ago

Okay, this is a very much valid issue. We should count the core-extensions with Joomla! (The 50% valuation). Thank you so much @brianteeman. You can raise a separate issue for that so that I can solve this ASAP.

brianteeman commented 4 years ago

No need for a new issue

ahamed commented 4 years ago

@brianteeman, I cannot understand the problem of language packages. At the table #__updates there are several elements with type package which has an extension_id = 0 and they are obviously not at #__extensions table. Then what are these?

brianteeman commented 4 years ago

if an extension is listed in the array I referred to above then it should not be counted as an extension in your calculations. On a clean install the count of extensions for the purposes of this module should be 0

ahamed commented 4 years ago

When I installed an outdated version of German DE language then it is not on the #__extensions table but the system says one extension is outdated.

Screenshot 2019-12-05 at 4 10 55 PM

As it is not on the #__extensions table so I cannot catch it as an installed extension.

ahamed commented 4 years ago

@brianteeman, It was my bad. After installing I get it on the #__extensions table.

thaoredweb commented 4 years ago

I think we can close this one. It is fine now a4