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

History filtering #382 #449

Merged
merged 10 commits into from May 19, 2017
Merged

History filtering #382 #449

merged 10 commits into from May 19, 2017

Conversation

D0nPiano
Copy link
Contributor

ToDos:

  • Test

Preview:
screenshot from 2017-04-10 21-29-45

@codecov-io
Copy link

codecov-io commented Apr 10, 2017

Codecov Report

Merging #449 into master will decrease coverage by 0.01%.
The diff coverage is 97.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #449      +/-   ##
==========================================
- Coverage   98.46%   98.45%   -0.02%     
==========================================
  Files         220      220              
  Lines        3137     3228      +91     
==========================================
+ Hits         3089     3178      +89     
- Misses         48       50       +2
Impacted Files Coverage Δ
client/app/components/group/_history/history.js 100% <ø> (ø) ⬆️
...ient/app/components/group/_history/history.spec.js 100% <100%> (ø) ⬆️
...pp/components/group/_history/history.controller.js 94.54% <94.28%> (-0.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1f1355...cb6b247. Read the comment docs.

@tiltec
Copy link
Member

tiltec commented Apr 11, 2017

Cool! Should we add a history tab to the stores as well?

this.updateFilteredData();
}

getAllStores(){
Copy link
Member

Choose a reason for hiding this comment

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

You could get rid of this function by using the values from the CurrentStores service.

this.updateFilteredData();
}

update(){
Copy link
Member

Choose a reason for hiding this comment

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

I would try use the angular digest cycle more, e.g. having a function that gets called in the template getEntries() and that function returns filtered history data. Advantage: less explicit data management code.

Type
</button>
<md-menu-content>
<md-menu-item type="checkbox" ng-click="$ctrl.update()" ng-model="$ctrl.types.groups">{{'HISTORY.TYPES.GROUPS' | translate}}</md-menu-item>
Copy link
Member

Choose a reason for hiding this comment

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

It is recommended to use the translate directive over filters to reduce the watches.
<span translate="HISTORY.TYPES.GROUPS"></span>

@tiltec
Copy link
Member

tiltec commented May 18, 2017

I'll work on this now

use CurrentStores and CurrentUsers as up-to-date values
avoid explicit update() functions
@tiltec
Copy link
Member

tiltec commented May 18, 2017

TODO:
(in addition to tests)

  • make user/store list scrollable
  • make user/store list searchable (it can get long)


showAllStores(bool) {
angular.forEach(this.getStores(), (store) => {
store._selected = bool;
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this, it changes the values in CurrentStores. But everything else seems to involve much more code (e.g. merging together two lists)

Copy link
Member

Choose a reason for hiding this comment

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

I would keep selected state in it's own object, something like:

var selectedStores = {};

// select a store
selectedStores[id] = true;

// unselect a store
delete selectedStores[id]

// check if a store is selected
selectedStores[id]

Copy link
Member

Choose a reason for hiding this comment

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

How does that go together with ng-model? E.g. here https://github.com/yunity/foodsaving-frontend/pull/449/files#diff-1491a792156b8840cb4c659ffb0de4ddR14

I'm not a huge fan of using getters/setters there, too much boilerplate.

Copy link
Member

Choose a reason for hiding this comment

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

ng-model="selectedStores[store.id]"

Maybe?

Sometimes have to use the ng-click on a checkbox instead.

Copy link
Member

Choose a reason for hiding this comment

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

There are much worse things than boilerplate too.

Copy link
Member

@tiltec tiltec May 19, 2017

Choose a reason for hiding this comment

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

Good idea, will refactor now.
(this feature here is not urgent at all, but I wanted to get it merged before the code around it changes too much.. might need to rethink my priorities though)

@tiltec
Copy link
Member

tiltec commented May 19, 2017

Didn't manage to enable scrolling in the user list, but otherwise it's ready for merging.

@tiltec tiltec merged commit f61b5fe into master May 19, 2017
@tiltec tiltec deleted the historyFiltering#382 branch May 19, 2017 19:09
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.

None yet

4 participants