Skip to content

Commit

Permalink
Merge pull request #14 from saleem-hadad/fix/formatting-number
Browse files Browse the repository at this point in the history
Formatting number #fix
  • Loading branch information
saleem-hadad authored May 17, 2022
2 parents 30495a5 + 92f6f41 commit 732dbda
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions app/BusinessLogic/ReportManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace App\BusinessLogic;

use App\Contracts\ReportManager as ReportManagerContract;
use App\Domain\Ranges\CurrentMonth;
use App\Domain\Ranges\LastMonth;
use App\Models\Brand;
use App\Models\Category;
use App\Models\Transaction;
use App\Domain\Ranges\LastMonth;
use App\Domain\Ranges\CurrentMonth;
use App\Contracts\ReportManager as ReportManagerContract;

class ReportManager implements ReportManagerContract
{
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function tryCreateFromSms($sms)
$amount = (float) filter_var($amountFromSms, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);

return static::create([
'amount' => round($amount),
'amount' => $amount,
'brand_id' => $brand->id,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=24b4cbec8d9a8be13a0e",
"/js/app.js": "/js/app.js?id=96b2be956563de5f8c09",
"/css/app.css": "/css/app.css?id=58adc592c995babafb87"
}
2 changes: 1 addition & 1 deletion resources/js/Utils/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { formatNumber, cutString } from '../';
it('formatNumber', () => {
expect(formatNumber(2000)).toBe('2k')
expect(formatNumber(-2000)).toBe('(2k)')
expect(formatNumber(-1530)).toBe('(1.53k)')
expect(formatNumber(-1530)).toBe('(1.530k)')
expect(formatNumber(-1530, '0[.]00a')).toBe('-1.53k')
});

Expand Down
2 changes: 1 addition & 1 deletion resources/js/Utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const getAppCurrency = () => {
return window ? window.AppCurrency : ''
}

export const formatNumber = (number, format = '(0[.]00a)') => {
export const formatNumber = (number, format = '(0[.]000a)') => {
const numbro = require('numbro');

numbro.setDefaults({ thousandSeparated: true, })
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/SmsTransactionProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function it_stores_processed_sms_with_known_payment_template_and_link_wit

$smsFromDB = Sms::first();
$this->assertEquals($knownBrand->name, $smsFromDB->transaction->brand->name);
$this->assertEquals('39.0', $smsFromDB->transaction->amount);
$this->assertEquals('38.7', $smsFromDB->transaction->amount);
}

/** @test */
Expand Down

0 comments on commit 732dbda

Please sign in to comment.