Commit 833233bc authored by Marco Sehrer's avatar Marco Sehrer
Browse files

Merge pull request #83 from ninjaconcept/83-add-reaction-attribute-to-elements-filter-in-sharemodal

Add reaction attribute to elements filter in ShareModal
parents 4307e652 296dbc8a
......@@ -14,7 +14,6 @@ export default class ShareModal extends React.Component {
constructor(props) {
super(props);
// TODO the same for reactions and so on
// TODO update for new check/uncheck info
let {currentUser, users} = UserStore.getState();
this.state = {
......@@ -51,8 +50,12 @@ export default class ShareModal extends React.Component {
all: uiState.sample.checkedAll,
included_ids: uiState.sample.checkedIds,
excluded_ids: uiState.sample.uncheckedIds
},
reaction: {
all: uiState.reaction.checkedAll,
included_ids: uiState.reaction.checkedIds,
excluded_ids: uiState.reaction.uncheckedIds
}
//TODO: Reactions Ids
};
return filterParams;
}
......@@ -82,7 +85,6 @@ export default class ShareModal extends React.Component {
elements_filter: filterParams,
user_ids: userIds
}
CollectionActions.createSharedCollections(paramObj);
this.hideModal();
}
......
require 'rails_helper'
RSpec.describe Usecases::Sharing::ShareWithUser do
let(:sample_1) { create(:sample) }
let(:sample_2) { create(:sample) }
let(:reaction_1) { create(:reaction) }
let(:reaction_2) { create(:reaction) }
let(:params) {
{
# TODO parent of collection?
......@@ -14,7 +20,8 @@ RSpec.describe Usecases::Sharing::ShareWithUser do
reaction_detail_level: 3,
wellplate_detail_level: 4
},
sample_ids: [1, 10]
sample_ids: [sample_1.id, sample_2.id],
reaction_ids: [reaction_1.id, reaction_2.id]
}
}
......@@ -37,10 +44,14 @@ RSpec.describe Usecases::Sharing::ShareWithUser do
end
it 'creates sample associations according to given params' do
c = Collection.find_by(label: 'test')
associated_sample_ids = CollectionsSample.where(collection_id: c.id).pluck(:sample_id)
associated_sample_ids = Collection.find_by(label: 'test').sample_ids
expect(associated_sample_ids).to match_array([sample_1.id,sample_2.id])
end
expect(associated_sample_ids).to match_array([1,10])
it 'creates reaction associations according to given params' do
associated_reaction_ids = Collection.find_by(label: 'test').reaction_ids
expect(associated_reaction_ids).to match_array([reaction_1.id, reaction_2.id])
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment