Skip to content
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

[FIX] summarizeFormat() - Format leaking across columns #1530

Merged

Conversation

dansysanalyst
Copy link
Member

⚡ PowerGrid - Pull Request

Welcome and thank you for your interest in contributing to our project!. You must use this template to submit a Pull Request or it will not be accepted.


Motivation

  • Bug fix
  • Enhancement
  • New feature
  • Breaking change

Description

This Pull Request fixes the bug described in the issue, which prevents applying a different Summary method formatting in each column.

    public function summarizeFormat(): array
    {
        return [
            'price.{sum,avg,min,max}' => fn ($value) => Number::currency($value, in: 'USD'),
            'price.{count}'    => fn ($value) => Number::format($value, locale: 'br') . ' price(s)',
            'calories.{avg}'   => fn ($value) => Number::format($value, locale: 'br', precision: 2) . ' kcal',
        ];
    }

Result:

CleanShot 2024-05-06 at 01 04 26@2x


In addition, from now on PowerGrid will throw an exception if the user does not follow the syntax column_name.{summarize_method} or does not send a callable in summarizeFormat().

Related Issue(s): #1529.

Documentation

This PR requires Documentation update?

  • Yes
  • No
  • I have already submitted a Documentation pull request.

@luanfreitasdev
Copy link
Collaborator

Thank you Dan!

@luanfreitasdev luanfreitasdev merged commit c855c70 into Power-Components:5.x May 6, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants