Skip to content

Commit

Permalink
Merge #1826 #1827
Browse files Browse the repository at this point in the history
1826: Correct some lint errors r=jniles

This PR fixes some errors of eslint to make sure the repository still clean
Thank you for contributing!

Before submitting this pull request, please verify that you have:
 - [x] Run your code through ESLint.  [Check out our styleguide](https://github.com/IMA-WorldHealth/bhima-2.X/blob/master/docs/STYLEGUIDE.md).
 - [x] Run integration tests.
 - [x] Run end-to-end tests.
 - [x] Accurately described the changes your are making in this pull request.

For a more detailed checklist, [see the official review checklist](https://docs.google.com/document/d/1nupLVLRXgSZJQo_acLgrwvPnN8RukfSiwRhSToj81uU/pub) that this PR will be evaluated against.

Ensuring that the above checkboxes are completed will help speed the review process and help build a stronger application.  Thanks!


1827: Update chai-as-promised to the latest version 🚀 r=jniles


## Version **7.1.0** of [chai-as-promised](https://github.com/domenic/chai-as-promised) just got published.

<table>
  <tr>
    <th align=left>
      Dependency
    </td>
    <td>
      chai-as-promised
    </td>
  </tr>
  <tr>
    <th align=left>
      Current Version
    </td>
    <td>
      6.0.0
    </td>
  </tr>
  <tr>
    <th align=left>
      Type
    </td>
    <td>
      devDependency
    </td>
  </tr>
</table>

The version **7.1.0** is **not covered** by your **current version range**.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of chai-as-promised.
Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


---


<details>
<summary>Release Notes</summary>
<strong>7.1.0</strong>

<p>Fixes Chai's proxy protection for property assertions (when using Chai v4 or higher). (<a href="https://urls.greenkeeper.io/meeber" class="user-mention">@meeber</a>, <a href="https://urls.greenkeeper.io/domenic/chai-as-promised/pull/205" class="issue-link js-issue-link" data-url="chaijs/chai-as-promised#205" data-id="235023818" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#205</a>)</p>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 8 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/4c2d628de0be636077e669c3aeb7d3a87ce21971"><code>4c2d628</code></a> <code>7.1.0</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/248810a508b94ca47473b9385aea2f9f151168a1"><code>248810a</code></a> <code>Fix proxies for property assertions (#205)</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/a60bf923d25f464a36a3d6ff4958137c397e1336"><code>a60bf92</code></a> <code>7.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/a92de93caea9803c11736a1208234d3be7d3a42c"><code>a92de93</code></a> <code>Convert tests away from CoffeeScript</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/ce2d4cb04bad5b2ea10f4bd5b74fdcc54ab89227"><code>ce2d4cb</code></a> <code>Add a note about using other Chai plugins</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/e8021e44021e769e1eed4dfdd85856b365287870"><code>e8021e4</code></a> <code>Update for Chai v4.0</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/16dde11e8d566771681dd6c39fd28716c9de69fa"><code>16dde11</code></a> <code>Various cleanups and updates</code></li>
<li><a href="https://urls.greenkeeper.io/domenic/chai-as-promised/commit/0dfd21181193bb1fd46664b35893bac75df6b004"><code>0dfd211</code></a> <code>Test all supported versions of Chai; assume Node v4+</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/domenic/chai-as-promised/compare/b2cfbdc71360dad1faaa29f64bcc8ba54819084e...4c2d628de0be636077e669c3aeb7d3a87ce21971">full diff</a></p>
</details>

<details>
  <summary>Not sure how things should work exactly?</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and of course you may always [ask my humans](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>


---


Your [Greenkeeper](https://greenkeeper.io) Bot 🌴
  • Loading branch information
bors[bot] committed Jul 13, 2017
3 parents 6e2deb8 + 25b44ad + 8e46d9a commit 84405c0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"devDependencies": {
"bower": "^1.7.7",
"chai": "^3.4.0",
"chai-as-promised": "^6.0.0",
"chai-as-promised": "^7.1.0",
"chai-datetime": "^1.4.0",
"chai-http": "^1.0.0",
"chai-spies": "^0.7.1",
Expand Down
13 changes: 9 additions & 4 deletions server/controllers/finance/accounts/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ function getPeriodAccountBalanceUntilDate(accountId, date, fiscalYearId) {
*/
function getComputedAccountBalanceUntilDate(accountId, date, periodId) {
const sql = `
SELECT IFNULL(SUM(debit), 0) as debit, IFNULL(SUM(credit), 0) as credit, IFNULL(SUM(debit_equiv - credit_equiv), 0) AS balance FROM general_ledger
WHERE account_id = ?
SELECT
IFNULL(SUM(debit), 0) as debit, IFNULL(SUM(credit), 0) as credit,
IFNULL(SUM(debit_equiv - credit_equiv), 0) AS balance
FROM
general_ledger
WHERE
account_id = ?
AND DATE(trans_date) <= DATE(?)
AND period_id = ?;
`;
Expand Down Expand Up @@ -146,8 +151,8 @@ function getOpeningBalanceForDate(accountId, date) {
return {
balance : (balance + runningPeriod.balance).toFixed(4),
credit : (credit + runningPeriod.credit).toFixed(4),
debit : (debit + runningPeriod.debit).toFixed(4)
}
debit : (debit + runningPeriod.debit).toFixed(4),
};
});
}

Expand Down
20 changes: 12 additions & 8 deletions server/controllers/finance/reports/reportAccounts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ function document(req, res, next) {
const expenseAccountId = 2;

const multipleFiscalYears = result.fiscalYearSpan > 1;
const incomeExpenseAccount = bundle.accountDetails.type_id === incomeAccountId || bundle.accountDetails.type_id === expenseAccountId;
const incomeExpenseAccount = (bundle.accountDetails.type_id === incomeAccountId) ||
(bundle.accountDetails.type_id === expenseAccountId);

if (multipleFiscalYears && incomeExpenseAccount) {
_.extend(bundle, {
warnMultipleFiscalYears : true
warnMultipleFiscalYears : true,
});
}
return report.render(bundle);
Expand All @@ -91,7 +92,6 @@ function document(req, res, next) {
}

function getNumberOfFiscalYears(dateFrom, dateTo) {

const sql = `
SELECT COUNT(id) as fiscalYearSpan from fiscal_year
WHERE
Expand Down Expand Up @@ -136,10 +136,14 @@ function getAccountTransactions(accountId, dateFrom, dateTo, openingBalance) {
// @TODO define standards for displaying and rounding totals, unless numbers are rounded
// uniformly they may be displayed differently from what is recorded
const sqlTotals = `
SELECT SUM(ROUND(debit_equiv, 2)) as debit, SUM(ROUND(credit_equiv, 2)) as credit, (SUM(ROUND(debit_equiv, 2)) - SUM(ROUND(credit_equiv, 2))) as balance
FROM general_ledger
WHERE account_id = ?
${dateCondition}
SELECT
SUM(ROUND(debit_equiv, 2)) as debit, SUM(ROUND(credit_equiv, 2)) as credit,
(SUM(ROUND(debit_equiv, 2)) - SUM(ROUND(credit_equiv, 2))) as balance
FROM
general_ledger
WHERE
account_id = ?
${dateCondition}
`;

const bundle = {};
Expand Down Expand Up @@ -168,7 +172,7 @@ function getAccountTransactions(accountId, dateFrom, dateTo, openingBalance) {
return db.one(sqlTotals, [accountId, dateFrom, dateTo]);
})
.then((totals) => {
let period = {};
const period = {};
period.debit = totals.debit;
period.credit = totals.credit;
period.balance = totals.balance;
Expand Down

0 comments on commit 84405c0

Please sign in to comment.