Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Moved estimated & remaining calculation logic to separate get method#35611

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:masterfrompeterjaap:patch-1
Feb 10, 2020

Conversation

peterjaap
Copy link
Contributor

@peterjaappeterjaap commentedFeb 6, 2020
edited by nicolas-grekas
Loading

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT

This way, we can usegetEstimated()andgetRemaining() to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set withsetPlaceholderFormatterDefinition without having to redefine the calculation ourself.

Example before;

ProgressBar::setPlaceholderFormatterDefinition('eta',function (ProgressBar$progressBar) {$estimated =round((time() -$progressBar->getStartTime()) / ($progressBar->getProgress() ?:0.1) *$progressBar->getMaxSteps());returndate('H:i:s',strtotime('+' .$estimated .' seconds'));    });

Example after;

ProgressBar::setPlaceholderFormatterDefinition('eta',function (ProgressBar$progressBar) {returndate('H:i:s',strtotime('+' .$this->getEstimated() .' seconds'));    });

@peterjaappeterjaap changed the titleMoved estimated calculation logic to separate get methodMoved estimated & remaining calculation logic to separate get methodFeb 6, 2020
@nicolas-grekasnicolas-grekas added this to thenext milestoneFeb 6, 2020
@nicolas-grekasnicolas-grekas changed the titleMoved estimated & remaining calculation logic to separate get method[Console] Moved estimated & remaining calculation logic to separate get methodFeb 6, 2020
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you apply fabbot's patch?

@peterjaap
Copy link
ContributorAuthor

@fabpot done! :)

@nicolas-grekas
Copy link
Member

The failure in tests is relevant to the change proposed here.

@peterjaap
Copy link
ContributorAuthor

@nicolas-grekas done 🎉

@fabpot
Copy link
Member

@peterjaap Can you rebase to get rid of the merge commit? Thank you.

@nicolas-grekas
Copy link
Member

Thank you@peterjaap.

nicolas-grekas added a commit that referenced this pull requestFeb 10, 2020
…c to separate get method (peterjaap)This PR was squashed before being merged into the 5.1-dev branch.Discussion----------[Console] Moved estimated & remaining calculation logic to separate get method| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MITThis way, we can use `getEstimated()`and `getRemaining()` to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set with `setPlaceholderFormatterDefinition` without having to redefine the calculation ourself.Example before;```phpProgressBar::setPlaceholderFormatterDefinition(    'eta',    function (ProgressBar $progressBar) {        $estimated = round((time() - $progressBar->getStartTime()) / ($progressBar->getProgress() ?: 0.1) * $progressBar->getMaxSteps());        return date('H:i:s', strtotime('+' . $estimated . ' seconds'));    });```Example after;```phpProgressBar::setPlaceholderFormatterDefinition(    'eta',    function (ProgressBar $progressBar) {        return date('H:i:s', strtotime('+' . $this->getEstimated() . ' seconds'));    });```Commits-------19958fb [Console] Moved estimated & remaining calculation logic to separate get method
@nicolas-grekasnicolas-grekas merged commit19958fb intosymfony:masterFeb 10, 2020
@nicolas-grekasnicolas-grekas modified the milestones:next,5.1May 4, 2020
@fabpotfabpot mentioned this pull requestMay 5, 2020
@peterjaappeterjaap deleted the patch-1 branchMay 6, 2020 03:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@stloydstloydstloyd left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

5 participants
@peterjaap@nicolas-grekas@fabpot@stloyd@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp