feat: compute total price for bill #108
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 {
|
||||
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 {
|
||||
minor,
|
||||
major,
|
||||
|
|
Loading…
Reference in a new issue