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

Add support for currency conversion for numerical steno input containing commas #1391

Merged
merged 3 commits into from
Oct 26, 2021

Conversation

stanographer
Copy link
Contributor

@stanographer stanographer commented Jul 28, 2021

Summary of changes

GOAL

Currency formatting currently only accepts pure digit inputs (3400000 for $3,400,000). Some stenographers write numbers using constructive shortcuts that glue digits with commas included.

THO*U = {^},000
F*UNT = {^},500,000
M*L = {^},000,000

We want to be able to properly format currency amounts when the input is 23,000 the same as 23000.

This doesn't work with the currency-formatting macro currently because commas break casting.(https://github.com/openstenoproject/plover/blob/master/plover/meta/currency.py#L11)

APPROACH

  1. Check if the contents of last_words is numerical i.e. is a string that contains at least one number.
  2. If it does, search for, and replace every instance of , and pass it along as the cast_input.
  3. Else, just pass the function the original string as it would originally.

Closes

This wasn't an official issue to my knowledge.

Pull Request Checklist

@stanographer stanographer changed the title add new code + tests STANLEYSAKAI Add support for currency conversion for numerical steno input containing commas Jul 28, 2021
@stanographer stanographer changed the title STANLEYSAKAI Add support for currency conversion for numerical steno input containing commas STANLEYSAKAI - Add support for currency conversion for numerical steno input containing commas Jul 28, 2021
@stanographer stanographer changed the title STANLEYSAKAI - Add support for currency conversion for numerical steno input containing commas SS - Add support for currency conversion for numerical steno input containing commas Jul 29, 2021
benoit-pierre and others added 3 commits October 11, 2021 23:38
As it's the separator character for thousands,
strip it before attempting currency formatting.
@benoit-pierre benoit-pierre changed the title SS - Add support for currency conversion for numerical steno input containing commas Add support for currency conversion for numerical steno input containing commas Oct 11, 2021
NEWS.md Outdated Show resolved Hide resolved
plover/meta/currency.py Outdated Show resolved Hide resolved
Copy link
Member

@morinted morinted left a comment

Choose a reason for hiding this comment

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

Thank you @stanographer !

@morinted morinted merged commit df1b333 into openstenoproject:master Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants