Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bh-currency-select throws an unhandled error on initialise (low priority) #3096

Closed
1 task done
sfount opened this issue Aug 29, 2018 · 1 comment · Fixed by #3097
Closed
1 task done

bh-currency-select throws an unhandled error on initialise (low priority) #3096

sfount opened this issue Aug 29, 2018 · 1 comment · Fixed by #3097
Labels

Comments

@sfount
Copy link
Contributor

sfount commented Aug 29, 2018

During testing of the cash module in #3095 it was noted that the bh-currency-select component always throws an undhandled error.

TypeError: Cannot read property 'currency' of undefined

This issue has never been reported as a bug so it doesn't look like it has an impact on the end users experience however it comes up frequently as this component is used in multiple places. It would be good to clean this up so that future changes can be built with a clean log.

The validation method on the component references a form attribute on the component that does not exist, it looks like this was potentially introduced as a work around to a previous version of angular's ng-form

As I understand the code there are two possible solutions:

  1. Remove the code directly, I will follow up with tests but I believe the component works without directly setting the $valid property of the underlying form elements.
  • Test the component with different inputs to ensure it works without the legacy code
  1. The sub form elements can be exposed to the controllers scope by using an ng-form wrapper around the currency select inputs. This would expose the $setValidity method that the current controller expects to exist. for example:
<!-- Attach 'form' to the components scope -->
<div ng-form="$ctrl.form">
   <!-- Currency select HTML inputs -->
</div>
@sfount sfount added the Bug label Aug 29, 2018
@sfount
Copy link
Contributor Author

sfount commented Aug 29, 2018

The component's validation behaviour works as expected with brief testing:

With one of the cash box currencies disabled:
one_disabled

With both of the cash box currencies disabled:
both_disabled

The error message shown is correct and the disabled/ valid attributes correctly propagate down form elements. It should be good to just remove the offending line of code as a legacy workaround.

bors bot added a commit that referenced this issue Aug 30, 2018
3097: Fix bh-currency-select unhandled error logging  r=jniles a=sfount

This commit removes a method forcing validation on form elements that
are updated by changes propegated in `ng-form` and closes #3096. 

It also updates the relevant controller code to repository standards. 

Co-authored-by: Steven Fountain <stevenfountain@imaworldhealth.org>
bors bot added a commit that referenced this issue Aug 30, 2018
3097: Fix bh-currency-select unhandled error logging  r=jniles a=sfount

This commit removes a method forcing validation on form elements that
are updated by changes propegated in `ng-form` and closes #3096. 

It also updates the relevant controller code to repository standards. 

Co-authored-by: Steven Fountain <stevenfountain@imaworldhealth.org>
@bors bors bot closed this as completed in #3097 Aug 30, 2018
mbayopanda pushed a commit to mbayopanda/bhima that referenced this issue Dec 15, 2018
3015: Update karma to the latest version 🚀 r=jniles a=greenkeeper[bot]




## Version **3.0.0** of **karma** was just published.

<table>
  <tr>
    <th align=left>
      Dependency
    </th>
    <td>
      <a target=_blank href=https://github.com/karma-runner/karma>karma</a>
    </td>
  </tr>
  <tr>
      <th align=left>
       Current Version
      </th>
      <td>
        2.0.5
      </td>
    </tr>
  <tr>
    <th align=left>
      Type
    </th>
    <td>
      devDependency
    </td>
  </tr>
</table>



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

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

It might be worth looking into these changes and trying to get this project onto the latest version of karma.

If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.


---


<details>
<summary>Release Notes</summary>
<strong>v3.0.0</strong>

<h3>Bug Fixes</h3>
<ul>
<li><strong>config:</strong> wait 20s for browser activity. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3087">#3087</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/88b977f">88b977f</a>)</li>
<li><strong>config:</strong> Wait 30s for browser activity per Travis. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3091">#3091</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/f6d2f0e">f6d2f0e</a>)</li>
<li><strong>init:</strong> add "ChromeHeadless" to the browsers' options (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3096">#3096</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/56fda53">56fda53</a>)</li>
<li><strong>server:</strong> Exit clean on unhandledRejections. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3092">#3092</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/02f54c6">02f54c6</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3064">#3064</a></li>
<li><strong>travis:</strong> Up the socket timeout 2-&gt;20s. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3103">#3103</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/732396a">732396a</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3102">#3102</a></li>
<li><strong>travis:</strong> use the value not the key name. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3097">#3097</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/90f5546">90f5546</a>)</li>
<li><strong>travis:</strong> validate TRAVIS_COMMIT if TRAVIS_PULL_REQUEST_SHA is not set. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3094">#3094</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/fba5d36">fba5d36</a>)</li>
<li><strong>travis:</strong> Validate TRAVIS_PULL_REQUEST_SHA rather than TRAVIS_COMMIT. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3093">#3093</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a58fa45">a58fa45</a>)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 17 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a4d5bdcbe36cbe12974fa9936a224a7837c5f0a4"><code>a4d5bdc</code></a> <code>chore: release v3.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/75f466dc172223cd8aa6fd7eec9bee810c982341"><code>75f466d</code></a> <code>chore: release v2.0.6</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/5db939907cabae3d0ef77ec08ae04563177116c2"><code>5db9399</code></a> <code>chore: update contributors</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/eb3b1b4ce8e0545832676289deb6e48bde5465fd"><code>eb3b1b4</code></a> <code>chore(deps): update mime -&gt; 2.3.1 (Third-Culture-Software#3107)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/732396a087c6dddeea2cf7f7493bf148a508725d"><code>732396a</code></a> <code>fix(travis): Up the socket timeout 2-&gt;20s. (Third-Culture-Software#3103)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/173848e3a0659bceea9d87d4eeee6c8a11c0f1a1"><code>173848e</code></a> <code>Remove erroneous change log entries for 2.0.3</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/10025695c4af3ea983c2c1316ec4ef078e056ebc"><code>1002569</code></a> <code>chore(ci): drop node 9 from travis tests (Third-Culture-Software#3100)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/02f54c6c57f5a3e0be3a44e8e5ca1db98b8dbc8f"><code>02f54c6</code></a> <code>fix(server): Exit clean on unhandledRejections. (Third-Culture-Software#3092)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/0fdd8f9e91b6039c07c857e11a5d7f7b3205cf01"><code>0fdd8f9</code></a> <code>chore(deps): update socket.io -&gt; 2.1.1 (Third-Culture-Software#3099)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/90f5546a9f88199f8118eae506922d4e8ee38945"><code>90f5546</code></a> <code>fix(travis): use the value not the key name. (Third-Culture-Software#3097)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/fba5d365146bad122d54af75bf191ad0b6091dd0"><code>fba5d36</code></a> <code>fix(travis): validate TRAVIS_COMMIT if TRAVIS_PULL_REQUEST_SHA is not set. (Third-Culture-Software#3094)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/56fda53ec19a1a691cd80342fef9b23d9f9fe4d2"><code>56fda53</code></a> <code>fix(init): add "ChromeHeadless" to the browsers' options (Third-Culture-Software#3096)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/f6d2f0ea5a3323c5e359e26fe5be9fbf68db819f"><code>f6d2f0e</code></a> <code>fix(config): Wait 30s for browser activity per Travis. (Third-Culture-Software#3091)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a58fa45c1df08ff4e74f9e75379f74c1311073c3"><code>a58fa45</code></a> <code>fix(travis): Validate TRAVIS_PULL_REQUEST_SHA rather than TRAVIS_COMMIT. (Third-Culture-Software#3093)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/88b977fcada5d08ae8d5bba9bc8eefc8404eff82"><code>88b977f</code></a> <code>fix(config): wait 20s for browser activity. (Third-Culture-Software#3087)</code></li>
</ul>
<p>There are 17 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/karma-runner/karma/compare/00189471d383600a95415ea526b152dd556ce751...a4d5bdcbe36cbe12974fa9936a224a7837c5f0a4">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴



Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant