fix: from_minor compilation error
This commit is contained in:
parent
39edaead04
commit
d4acccde9d
1 changed files with 6 additions and 1 deletions
|
@ -53,7 +53,12 @@ impl Price {
|
||||||
|
|
||||||
pub fn from_minor(minor_only: usize, currency: Currency) -> Price {
|
pub fn from_minor(minor_only: usize, currency: Currency) -> Price {
|
||||||
let minor = minor_only % 100;
|
let minor = minor_only % 100;
|
||||||
let major = (minor_only - minor) / 100;
|
let major_only = minor_only - minor;
|
||||||
|
let major = if major_only == 0 {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
(minor_only - minor) / 100
|
||||||
|
};
|
||||||
Price {
|
Price {
|
||||||
minor,
|
minor,
|
||||||
major,
|
major,
|
||||||
|
|
Loading…
Reference in a new issue