Skip to content

Allow Notifier component to limit amount of notifications to return.#8

Open
akkaweb wants to merge 9 commits into
bakkerij:masterfrom
akkaweb:master
Open

Allow Notifier component to limit amount of notifications to return.#8
akkaweb wants to merge 9 commits into
bakkerij:masterfrom
akkaweb:master

Conversation

@akkaweb

@akkaweb akkaweb commented Mar 23, 2016

Copy link
Copy Markdown

Changes to the method getNotifications() to accept a 3rd paremeter $limit = null and make the necessary code changes to accept limit. README.md also changed to reflect Component changes.

akkaweb added 2 commits March 23, 2016 14:49
README has instructions for method `allNotificationList()`, but component does not have this method. Replacing instruction with `getNotifications()` instead.
Change `getNotifications()` method to accept a 3rd parementer for $limit and make code changes to pull from DB
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.07%) to 79.851% when pulling 413dd9e on akkaweb:master into 80bb26c on cakemanager:master.

@bobmulder

Copy link
Copy Markdown
Contributor

Hi @akkaweb,

First of all, thank you for the PR! However, I have some suggestions for you.

  1. As you see Travis failed. The reason you can see why: here. You didn't handle any code-standard. Thats why the file list is f*cked up, so I can't see that clear what code you added/changed. If you're not familiar with code standards let me know.

  2. No tests are added for this functionality. Thats why coveralls came in to say that the coverage decreased. Please add tests to see if the method works without limit, and with multiple limits.

If you have questions, feel free to chat me!

Looking forward to your changes! Good luck!

@bobmulder bobmulder self-assigned this Mar 23, 2016
@akkaweb

akkaweb commented Mar 23, 2016

Copy link
Copy Markdown
Author

My apologies about that. I mostly develop for Drupal and my IDE is setup to work with their coding standards. I will fix and resubmit.

Comply with CakePHP coding standards
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.07%) to 79.851% when pulling 1d447dc on akkaweb:master into 80bb26c on cakemanager:master.

Added 2 test cases for the newly added $limit parameter
@akkaweb

akkaweb commented Mar 24, 2016

Copy link
Copy Markdown
Author

I updated the code to comply with CakePHP standards. I will watch Travis to see if it allows it to pass now. Test cases have been added now.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling 3089569 on akkaweb:master into 80bb26c on cakemanager:master.

Comment thread README.md Outdated

// getting a list of all unread notifications
$this->Notifier->allNotificationList(2, true);
// getting a list of all unread notifications for user with ID 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I documented with 'id', here you did it with 'ID' and below you typed 'Id'. What will it be? I suggest 'id'.

@bobmulder

Copy link
Copy Markdown
Contributor

@akkaweb Thank you! Good work! I added some comments you should look at. Also the code-coverage gave one error: https://travis-ci.org/cakemanager/cakephp-notifier/jobs/118129153#L278. If you can fix these, it will be okay!

As I see, you added a tirth parameter the the method, which is good enough. But I was tinking, to be prepared of the future, we could make the tirth parameter an array, with the option limit. What do you think about that?

akkaweb added 3 commits March 24, 2016 09:45
Change 3rd parameter to an array which allows the possibility for future expansion. Currently it only supports 'limit' - $options['limit']
Making changes to documentation to include $options array as 3rd parameter. Currently it only supports 'limit' - $options['limit']
Updating test cases to accept array as 3rd parameter with 'limit' as only key support at the moment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling 15f325c on akkaweb:master into 80bb26c on cakemanager:master.

@akkaweb

akkaweb commented Mar 24, 2016

Copy link
Copy Markdown
Author

I totally agree about the 3rd parameter being an array. Thanks for catching that! I put that change into place, changed test cases to reflect that update and I also updated code-coverage to include the 3rd option. Hopefully all the tests will now pass. If any issues or if you would like something changed let me know. Thanks

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling 15f325c on akkaweb:master into 80bb26c on cakemanager:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling 15f325c on akkaweb:master into 80bb26c on cakemanager:master.

Travis check failed to whitespace at the end of line and a non-existent space after If. Should pass now!
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling dc0b243 on akkaweb:master into 80bb26c on cakemanager:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.4%) to 81.343% when pulling 181ad20 on akkaweb:master into 80bb26c on cakemanager:master.

@bobmulder

Copy link
Copy Markdown
Contributor

Sorry for leaving this behind @akkaweb. Lets finish this :)

I see you did 9 commits.

I would like to see the commits squased (read more at http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html and http://couscous.io/contributing.html)

Greetz,

Bob

@akkaweb

akkaweb commented Apr 25, 2016

Copy link
Copy Markdown
Author

@bobmulder Sure! I will give it a go soon! Thanks!

Comment thread README.md
Of course you want to get a list of notifications per user. Here are some examples:

// getting a list of all notifications of the current logged in user
// getting a list of all notifications of the current Logged In user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont think that change was valid :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants