Skip to content

Conversation

@heelc29
Copy link
Contributor

@heelc29 heelc29 commented Sep 13, 2023

Pull Request for Issue #41710 .

Summary of Changes

revert parts from #41710
@brianteeman @HLeithner

com_finder: uses number_format

<caption class="caption-top"><?php echo Text::sprintf('COM_FINDER_STATISTICS_STATS_DESCRIPTION', number_format($this->data->term_count, 0, Text::_('DECIMALS_SEPARATOR'), Text::_('THOUSANDS_SEPARATOR')), number_format($this->data->link_count, 0, Text::_('DECIMALS_SEPARATOR'), Text::_('THOUSANDS_SEPARATOR')), number_format($this->data->taxonomy_node_count, 0, Text::_('DECIMALS_SEPARATOR'), Text::_('THOUSANDS_SEPARATOR')), number_format($this->data->taxonomy_branch_count, 0, Text::_('DECIMALS_SEPARATOR'), Text::_('THOUSANDS_SEPARATOR'))); ?></caption>

plg_content_vote: is float

// Get rating
$rating = (float) $row->rating;
$rcount = (int) $row->rating_count;
// Round to 0.5
$rating = round($rating / 0.5) * 0.5;

finderindex: uses round

$text = Text::sprintf('FINDER_CLI_BATCH_COMPLETE', $i + 1, $processingTime = round(microtime(true) - $this->qtime, 3));

Testing Instructions

com_finder/statistics: values above 1000
plg_content_vote: two votes (5+4)/2=4.5
finderindex: run cli/joomla.php findex:index

Actual result BEFORE applying this Pull Request

image
image
image

Expected result AFTER applying this Pull Request

image
image
image

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed

@tecpromotion
Copy link
Contributor

I have tested this item ✅ successfully on 081e913


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41740.

1 similar comment
@Quy
Copy link
Contributor

Quy commented Sep 13, 2023

I have tested this item ✅ successfully on 081e913


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41740.

@Quy
Copy link
Contributor

Quy commented Sep 13, 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/41740.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 13, 2023
@wilsonge
Copy link
Contributor

Rather than string can we use %f for a float? It is still a number at the end of the day.

@HLeithner
Copy link
Member

does %f work @heelc29 ?

@heelc29
Copy link
Contributor Author

heelc29 commented Sep 13, 2023

does %f work @heelc29 ?

The first one com_finder.ini: No because it is a string - see https://www.php.net/manual/en/function.number-format.php

The others: There is a different for number of digits to be printed after the decimal point (by default, this is 6) https://www.php.net/manual/en/function.sprintf.php

Example:

value: 45.12
output (s) 45.12
output (f) 45.120000

@HLeithner HLeithner merged commit b2ce3a9 into joomla:5.0-dev Sep 13, 2023
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 13, 2023
@HLeithner
Copy link
Member

I merge this for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants