Skip to content

Finding of Relations Broken #82

Description

@lgleim

In the current version of the code, the recommendation of relations between two classes is broken.
The problem is that getAvailableProperties(...) in

subjects[0].getAvailableProperties(':relation', null)
.then(filterPropertyCollection)
.then(function (availableProperties) {
$scope.subjects[0].$availableProperties = availableProperties;
});
subjects[1].getAvailableProperties(':relation', null)
.then(filterPropertyCollection)
.then(function (availableProperties) {
$scope.subjects[1].$availableProperties = availableProperties;
});
always returns an empty array since it is looking for properties which have a type of ':relation' by applying this
var customFilters = {
pre: function (array, searchTerm) {
if (!_.isArray(array) || !_.isString(searchTerm) || _.isEmpty(searchTerm)) {
return {};
}
var types = _(array).pluck('type').uniq()
.map(function (type) {
return type.toLowerCase().replace('_property', '');
}).value();
var searchRegex = new RegExp(':(' + _.map(types, _.escapeRegExp).join('|') + ')(?=\\s+|$)', 'ig');
if (!searchTerm.match(searchRegex)) {
return {};
}
var classToken = _.words(searchTerm, searchRegex)[0]
.toUpperCase().replace(':', '') + '_PROPERTY';
return {
array: _.where(array, {type: classToken}),
filter: searchTerm.replace(searchRegex, '')
};
}
};
filter function here
var temp = filterFunction(array, filter);
.

A workaround (which half way works) is to replace all occurrences of ":relation" with null in this file https://github.com/leipert/vsb/blob/148c51ae1790673c3b14629145492e74845e2ef0/app/modules/workspace/modals/findRelationModalCtrl.js

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions