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

Rewrite cash missing debtor error text #3100

Closed
jniles opened this issue Aug 30, 2018 · 20 comments
Closed

Rewrite cash missing debtor error text #3100

jniles opened this issue Aug 30, 2018 · 20 comments

Comments

@jniles
Copy link
Collaborator

jniles commented Aug 30, 2018

If a user tries to register invoices to the cash window without first selecting a debtor, the system will display a small error message with almost incomprehensible text. It is shown below.

missingdebtorerrortext

It would be helpful if this text would direct the user that they should first choose a patient, then attempt to pay their bills.

@AdamWatts
Copy link
Contributor

Hi, I would like to take on this issue. Setup might take bit but should be pretty quick.

@jniles
Copy link
Collaborator Author

jniles commented Sep 2, 2018

Hey @AdamWatts, great to have you on board!

If you have any questions, please to feel free to ask!

@AdamWatts
Copy link
Contributor

Thanks @jniles. I'm running into issues getting the DB running, I've done some research and I believe its because I'm on WSL for windows microsoft/WSL#2941. There might be a work around, not sure yet. I'm not certain I need to get the DB working just to fix this error message, but I was assuming you would like it thorough; have all test run and pass before merge.

@sfount
Copy link
Contributor

sfount commented Sep 4, 2018

Hi @AdamWatts, I've had some experience with WSL and would love to help you get up and running!

A workflow that I like using on Windows is to take advantage of Windows editors and ecosystem (I personally use VSCode) but use WSL for the services running in the background, in the case of this project these are MySQL and Redis.

You mentioned that there was an issue with the database, hopefully I can give some pointers with how I got MySQL up and running.

I've had a lot of issues with the latest version of Ubuntu (18.04) with WSL, in fact I think the MySQL installation process fails with this. Because of this I'm still using Ubuntu (16.04) which you can find as a separate application in the Windows store Link to store.

You can double check that it's running 16.04 with the command

lsb_release -a

From here we can set up MySQL:

sudo apt update 
sudo apt upgrade 

# This will have you set the mysql root password in an interactive session
sudo apt install mysql-server 

# Because of a quirk on WSL (this is a common theme!) the mysql service 
# doesn't correctly start, we can start this manually though 
sudo service mysql start 

# We can now login to MySQL - the instance should be running correctly 
msyql -u root -p 

# The redis installation is much simpler 
sudo apt install redis-server
sudo service redis-server start 

# Double check redis server is up and running - this should return PONG
redis-cli ping 

These two services can now be accessed from Windows simply as if it is running locally (on 127.0.0.1).

It should be possible to follow the install instructions for building the database etc. Install.md

From my experience there has been a lot of fighting with making different services run on WSL, but I can assure you it works! Running Linux in a Virtual Machine is also a great way to get up and running with Linux on Windows.

Please let me know if this helps get the database up and running, if there's anything keeping you from getting the full system connected you can let me know!

@AdamWatts
Copy link
Contributor

@sfount Hey thanks for the help. I use VS Code as well with Oh My Zsh but I'm using Debian 9, trying to get a feel for Linux. Thinking of getting one for my next machine. DLing 16.04 right now, going to give that a try. I'll let you know how it goes.

@AdamWatts
Copy link
Contributor

@sfount Okay so with 16.04 everything seemed to be going smoothly, I was able to Configure the bhima user in MySQL and build the app or I thought. Once I ran build:db script I got the same error as before

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I was able to get something of the app on localhost but unable to login.
with errors code: 'ECONNREFUSED'

So my guess was the configuration of the bhima user in MySQL didn't work, but when I re-attempt I get the original error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Its late now, I'll give it another shot in the morning.
Thanks for the help and patience, sorry I'm really just getting started in opensrc.

@sfount
Copy link
Contributor

sfount commented Sep 4, 2018

@AdamWatts I can definitely encourage getting a feel for Linux when it comes to web development; many resources online assume a 'nix based system and being comfortable with the basics can really help out.

Re: the setup, it sounds like you're most of the way there! Our MySQL error here is a cryptic one, 9 times out of 10 a MySQL socket error is just a complicated way of telling you that the MySQL server isn't running at all so it can't connect.

Services on WSL have a bug that prevents the startup 'daemon' from correctly starting the service when Linux starts. What this means is you had probably restarted your computer or Ubuntu application between configuring the bhima user and running the build:db script.

Unfortunately after a long time trying to get these services to start correctly I gave in and created a small script that I run myself when I start Ubuntu.

start_services.sh

#!/bin/bash
# WSL service start patch
sudo service mysql start 
sudo service redis-server start 

With this script we can manually start the services, note that this is not how these services work in general on Linux, on any other system you should expect these services to always be running in the background.

# Tell Linux that this file can be executed - this only needs to be run once 
chmod +x start_services.sh

# Finally running the script will ask for your sudo password to start the services 
./start_services.sh

Any time that restart your computer, this script will need to be run again until WSL figure out the services related bug.

(Note if you have any other MySQL servers running, on Windows for example, it is possible that they are both trying to bind the default port of 3306 and colliding - I think this is very unlikely though, as I said the var/run/mysqld/mysqld.sock error is almost always complaining that MySQL hasn't started.)

Hopefully knowing this and getting the services started will let you continue with building the database! If it keeps giving us a problem, we could investigate other ways of running Linux or setting up on Windows itself.

Please let me know how you get on with this, I'm happy to help and really appreciate the interest in both open source and this project!

@AdamWatts
Copy link
Contributor

@sfount Alright awesome this solution worked perfectly, everything seems to be running well. I now am prompt with the login form on localhost. Quick question though, what should the login credentials be? I thought it would be the user configuration -u -p from the DB but I'm mistaken.

@sfount
Copy link
Contributor

sfount commented Sep 4, 2018

@AdamWatts Glad to hear it!

The build:db command that you've run for set up builds an SQL file that inserts data for testing the system, this is what creates the system users. You can find it in test/data.sql (line 312).

A good account to use for getting familiar with the application would be username: superuser password: superuser. This user has been created to have permission to all modules. We can certainly update the getting started documentation to make this clearer.

@AdamWatts
Copy link
Contributor

@sfount Thank you for the clarification. Yes I think updating the documentation would be helpful for newcomers. I'm feeling a little groggy today, so I might just try and get familiar with the app today. Then work on the issue tomorrow.

@sfount
Copy link
Contributor

sfount commented Sep 5, 2018

@AdamWatts it looks like there is a great entry on getting into the application on the Getting Up and Running under 'Resources for Contributors' on the wiki. I just didn't know to point you in that direction!

If you have any suggested changes to the wiki or install guide based on your new perspective we could use the help! Pull requests can be made for this documentation in the same way as code changes. Good luck and thanks!

@AdamWatts
Copy link
Contributor

AdamWatts commented Sep 6, 2018

So I'm new to angular but I have some react experience. I was able to find the controller who's state params are being called for this particular error message in https://github.com/IMA-WorldHealth/bhima-2.X/blob/7c3822f7f6749d2992e6c0d0285ddb3ed9ec04ca/client/src/modules/cash/modals/invoice-modal.ctrl.js#L25 and the controller is receiving a list of debtor invoices from the server, and if I'm not mistaken the server is being populated with info from the DB. Still trying to understand the system, get familiar, and hunt this down. Any direction would be appreciated :)

Need to get to these params and change msg? https://github.com/IMA-WorldHealth/bhima-2.X/blob/7c3822f7f6749d2992e6c0d0285ddb3ed9ec04ca/client/src/modules/cash/modals/invoice-modal.html#L17

Never mind found it :) all that is required I think is to edit this error https://github.com/IMA-WorldHealth/bhima-2.X/blob/7c3822f7f6749d2992e6c0d0285ddb3ed9ec04ca/client/src/i18n/en/form.json#L117

Re-build the app, then re-run it.

Suggestions on a more clear error message? Should we also edit the French message to be more clear?

@jniles
Copy link
Collaborator Author

jniles commented Sep 6, 2018

Hey @AdamWatts, great work!

In my view, a short message that tells the user how to fix the problem is preferable. I imagine "Please select a patient before the invoices" would do just fine.

The French translations will be in an identical location fr/form.json. If you feel confident in French, go ahead an take a wack at it! Otherwise, either myself or one of our native speakers (@lomamech @mbayopanda) will add in the French translations separately.

Awesome that you've gotten this far on WSL!

@AdamWatts
Copy link
Contributor

@jniles Thanks.

Cool I'll just use that, unless I come up with something genius lol.

I was just going to use google translate so it might be better if someone fluent did ¯_(ツ)_/¯

@AdamWatts
Copy link
Contributor

AdamWatts commented Sep 6, 2018

@jniles

So I ran the client-unit tests and got

clientunitpass

Then again with

clientunitfail

I'm pretty new to running tests on projects such as this so I'm not to sure what to make of the results...

Also for the branch name I was going to go with

refactor-cash-missing-debtor-error-text

For the commit message

chore(i18n): refactor en.json key

bors bot added a commit that referenced this issue Sep 7, 2018
3155: chore(i18n): refactor en.json key r=jniles a=AdamWatts

For issue 

Closes #3100

Co-authored-by: Adam Watts <adamt.watts@gmail.com>
Co-authored-by: mbayopanda <mbayopanda@gmail.com>
@bors bors bot closed this as completed in #3155 Sep 7, 2018
@jniles
Copy link
Collaborator Author

jniles commented Sep 7, 2018

@AdamWatts, the unit tests spin up a chrome browser with Karma and it looks like that may not be working correctly on your machine. Since we run our tests online before merging (as you've seen), it's not that big a deal.

I am curious, do your integration tests pass? You can run them with yarn test:integration or npm run test:integration.

@AdamWatts
Copy link
Contributor

@jniles I'm not really sure what happened, but I cant run/build anything right now. Can't seem to find gulp-rev-rewrite module....I'll let you know once I solve this.

Error: Cannot find module 'gulp-rev-rewrite'

@sfount
Copy link
Contributor

sfount commented Sep 7, 2018

@AdamWatts occasionally the libraries the project depends on will change, usually this is accompanied by a pull request with the label 'Breaking Changes' and it means new libraries will need to be downloaded.

The good news is that updating your dependencies is as simple as

yarn

Yarn is the package manager so if there is ever an issue with a module, that is the place to look! Running yarn will check the package.json for changes and make sure you are all up to date.

EDIT for you information the pull request that updated dependencies landed 2 days ago and was a small update to the way the Javascript build tools work. You can find it here #3123

@AdamWatts
Copy link
Contributor

@sfount Awesome, thank you. I was using npm because I already had it installed, but just downloaded yarn and updated the dependencies, everything seems to be in order. Other than running the tests.

@AdamWatts
Copy link
Contributor

AdamWatts commented Sep 7, 2018

@jniles I was getting an error about chrome binary with CHROME_BIN so I went to the Karma Docs and ran

//Changing the path to the Chrome binary
$ export CHROME_BIN=/usr/local/bin/my-chrome-build

fixed that error

but the tests are still not running properly, I got a massive output of errors. Unsure if I should post it or not.

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
Projects
None yet
Development

No branches or pull requests

3 participants