Skip to content

Commit

Permalink
Show all pending txn (#43)
Browse files Browse the repository at this point in the history
* Update BillInfoComponent.tsx

* Show all pending txns

* Fix typo
  • Loading branch information
errietta authored Feb 10, 2020
1 parent b8b9cc1 commit 402e409
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/NextBill/BillInfoComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ interface BillInfoComponentProps {

export const BillInfoComponent = (props: BillInfoComponentProps) => (
<div>
<p>Next {props.type} around the <b>{moment(props.transactions[0].date).format('Do')}</b>:</p>
<p>Next {props.type}:</p>
<ul>
{
props.transactions.map((transaction, idx) => (
<li key={idx}>{transaction.description}, about <b>&pound;{transaction.debitAmount}</b></li>
<li key={idx}>{transaction.description}, taken around
{moment(transaction.date).format('Do')}, for about <b>&pound;{transaction.debitAmount}</b></li>
))
}
</ul>
Expand Down
7 changes: 1 addition & 6 deletions src/components/NextBill/NextBillComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ const findNextBills = (group, currentTxn: Transaction[]) => {
))
));

// find only the first closest day that has pending txns
const sameDayTxn = filtered.filter((txn: Transaction, _idx: number, txnArr) => (
moment(txn.date).startOf('day').isSame(moment(txnArr[0].date).startOf('day'))
));

return sameDayTxn;
return filtered;
};

const findCurrent = txns => (
Expand Down

0 comments on commit 402e409

Please sign in to comment.