cross-solution / YAWIK

YAWIK is a web application. It can be used as an ATS applicant tracking system or as a jobboard.
https://yawik.org
MIT License
125 stars 67 forks source link

make the name of organizations searchable and sortable #211

Closed cbleek closed 8 years ago

cbleek commented 8 years ago

auswahl_963

fedys commented 8 years ago

Can I implement it?

cbleek commented 8 years ago

Yes. For sure. Mathias will add some technical specs, which might be usefull

TiSiE commented 8 years ago

As the organization names are stored in a dedicated collection, it is not so trivial to make the names in the list sortable.

The easiest solution is imho to store the name as redundant information in the organization entity. The drawback is, that we have to update that information if the organization name changes, which will fortunately not be that often.

Analogically to https://github.com/cross-solution/YAWIK/blob/develop/module/Applications/src/Applications/Entity/Application.php#L167 where the job user id is stored for easier find queries.

For the view part, there are working solutions. For example the pagination lists in the admin section all uses the new TextSearchForm element and the associated view helpers. The view scripts themselves are great examples how to implement the pagination list.


https://github.com/cross-solution/YAWIK/blob/develop/module/Auth/view/auth/users/list.phtml https://github.com/cross-solution/YAWIK/blob/develop/module/Auth/view/auth/users/list.ajax.phtml https://github.com/cross-solution/YAWIK/blob/develop/module/Auth/src/Auth/Controller/UsersController.php https://github.com/cross-solution/YAWIK/blob/develop/module/Core/src/Core/Form/TextSearchForm.php https://github.com/cross-solution/YAWIK/blob/develop/module/Core/src/Core/Form/TextSearchFormButtonsFieldset.php https://github.com/cross-solution/YAWIK/blob/develop/module/Core/src/Core/Form/TextSearchFormFieldset.php https://github.com/cross-solution/YAWIK/blob/develop/module/Core/src/Core/Form/View/Helper/SearchForm.php

also very interesting: http://yawik.readthedocs.io/en/latest/modules/core/pagination/views.html

which describe the use of https://github.com/cross-solution/YAWIK/blob/develop/module/Core/public/js/core.pagination-container.js in the view scripts.

fedys commented 8 years ago

Is desired following current behaviour: when user updates existing organization name then new entity \Organizations\Entity\OrganizationName is created every time?

fedys commented 8 years ago

implemented in the issue-211 branch

TiSiE commented 8 years ago

No. If a an organization name is updated, it should look up the organization name collection if the new name already exists and if so just increase the counter. However, if the name does not exist, it should indeed be created.

The organization entity only holds a reference to the organization name entity.

I'm pretty sure it is implemented that way, but I'm maybe wrong....

fedys commented 8 years ago

Yes, the logic you describe works. Thanks for clarification.

cbleek commented 8 years ago

The Idea behind this behaviour is:

It should be possible to rank OrganizationNames by relevance. If an OrganizationName is used by an applicant in his employment history, the relevance is increased. The same is done, if an OrganizationName is used as a Name of the hireing organization.

fedys commented 8 years ago

@cbleek thanks, I grasp the point now.

TiSiE commented 8 years ago

To update the database to make this work with existent organiaztion entries run this query:

db.getCollection('organizations.names').find().forEach(function(name) {
    db.getCollection('organizations').update(
        {organizationName: name._id}, 
        {$set: {_organizationName: name.name}}, 
        {multi: true}
    ); 
});