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

Project client #70

Merged
merged 14 commits into from
Feb 5, 2016
Merged

Conversation

lomamech
Copy link
Collaborator

@lomamech lomamech commented Feb 2, 2016

Updated part client of unit project and adding the test end to end

@jniles @DedrickEnc

var service = this;

service.create = create;
service.read = read;
service.update = update;
service.delete = del;
service.del = del;
service.readComplete = readComplete;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the $http service to set querystrings for you via a configuration object. Here is the relevant documenation.

Instead of creating a whole new method, you should just use service.read! Something like this:

function read(id, params) {
   var url = (id) ? '/projects/' + id : '/projects';
   return $http.get(url, { params : params });
}

// in your controller
ProjectService.read(null, { complete : 1 })
.then(function (projects) {
  console.log('The complete projects:', projects);
});

AngularJS should automatically serialize the parameters into a query string for you.

@jniles
Copy link
Collaborator

jniles commented Feb 2, 2016

@lomamech, I've completed an initial review. Somethings to remember:

  1. All of the server routes must have req, res, next as parameters. Using next() is the best practice for handling errors in your routes. In your get_snis_zs route, you do not have any error handling at all.
  2. According to Travis, you have an error in your SQL syntax. (In MySQL, you cannot have comments like "--comment".... there must be a space in between the "--" and the "comment"). Did you actually build the test database before submitting this PR?

Thank you for using the "@jniles" syntax. Let me know when you've look into these errors.

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 2, 2016

@jniles I'm looking at thes errors and I start simultaneously correction

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 3, 2016

@jniles @DedrickEnc I just correct errors but also to make improvements,

@jniles
Copy link
Collaborator

jniles commented Feb 3, 2016

@lomamech, this is good to see. Your integration tests do not pass. Here are your results.

I'll review the code when the tests pass.

var service = this;

service.create = create;
service.read = read;
service.update = update;
service.delete = del;
service.del = del;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jniles just to not have a big difference with the other function

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good intention, but the reason we cannot call the function "delete" is because delete is a javascript reserved word. To make the API clear, the API should still be called service.delete.

SnisService.$inject = ['$http', 'util'];

function SnisService($http, util) {
var service = {};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var service = this.

@jniles
Copy link
Collaborator

jniles commented Feb 3, 2016

@lomamech, the end to end tests pass for me on master, but do not pass on your branch. I've uploaded your results.

Please, please, run end to end tests and integration tests before submitting a PR.

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 3, 2016

@jniles end to end tests and integration tests run very well

@jniles
Copy link
Collaborator

jniles commented Feb 3, 2016

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 4, 2016

@jniles 6 test end to end had fails because the data format sended by ProjectService

<button class="btn btn-sm btn-default" id="create" ng-click="ProjectCtrl.create()" data-method="create">
<span class="glyphicon glyphicon-plus-sign"></span> {{ 'PROJECT.NEW' | translate }}
</button>
</div>

<div class="report visible-print">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete this entire section (<div class="report visible-print>") - it is no longer used and is bad practice. It also slows down the loading of the module.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not fixed. Please delete this entire <div>.

<div class="form-group">
<label class="col-md-3 control-label">{{ 'COLUMNS.LOCKED' | translate }}</label>
<div class="col-md-9">
<input type="checkbox" id="locked" ng-true-value="1" ng-false-value="0" name="bhima-project-locked" ng-model="ProjectCtrl.project.locked">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proper way to make a bootstrap checkbox input is to use the "checkbox" class. Here is the documentation. You should be using the "checkbox" class on a <div> and wrapping the <label> element around the checkbox.

@jniles
Copy link
Collaborator

jniles commented Feb 4, 2016

@lomamech, these are very nice tests. I'm glad that the ProjectService API change was caught, that could have been a painful bug in the future.

I've made some comments, mostly on HTML and CSS style. Since we are now using bootstrap rules for styling, it is important that we abide by bootstrap standards. There is also a whole section that can be deleted - it was useful before we learned how to create PDF reports.

There is one test to add based on a bug that I found in the $window.confirm() alert box. That bug should be fixed before this PR can be merged.

Overall, this code and PR is looking very good. Once it is bug free and up to standards, it will be a valuable contribution.

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 5, 2016

@jniles did you analyze the latest changes

@jniles
Copy link
Collaborator

jniles commented Feb 5, 2016

You must let me know when to analyze changes again by leaving a comment. Otherwise, I do not know if you will add more or not.

You have one more change to make, then this can be merged in, assuming it passes tests. There's a lot of unused HTML that should be deleted.

@lomamech
Copy link
Collaborator Author

lomamech commented Feb 5, 2016

@jniles I just did it

@jniles
Copy link
Collaborator

jniles commented Feb 5, 2016

LGTM.

jniles added a commit that referenced this pull request Feb 5, 2016
@jniles jniles merged commit ed82287 into Third-Culture-Software:master Feb 5, 2016
jniles referenced this pull request in jniles/bhima Jan 9, 2017
This commit implements meaningful, translated server error messages.
This should help a user know what went wrong with a little bit more
accuracy.

Closes #70.  Closes #97.
jniles referenced this pull request in jniles/bhima Jan 9, 2017
This commit implements meaningful, translated server error messages.
This should help a user know what went wrong with a little bit more
accuracy.

Closes #70.  Closes #97.
sfount pushed a commit to sfount/bhima-2.X that referenced this pull request Jan 10, 2017
This commit implements meaningful, translated server error messages.
This should help a user know what went wrong with a little bit more
accuracy.

Closes Third-Culture-Software#70.  Closes Third-Culture-Software#97.
@lomamech lomamech deleted the projectClient branch May 15, 2017 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants