Skip to content

Commit

Permalink
fix generated bug after edit group and category (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirineMhedhbi authored Sep 6, 2023
1 parent e85462f commit 4442776
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def update
start = Time.now
begin
category = LinkedData::Client::Models::Category.find_by_acronym(params[:id], include: ATTRIBUTE_TO_INCLUDE ).first
add_ontologies_to_object(category_params[:ontologies],category) if (category_params[:ontologies].size > 0 && category_params[:ontologies].first != '')
add_ontologies_to_object(category_params[:ontologies],category) if (category_params[:ontologies].present? && category_params[:ontologies].size > 0 && category_params[:ontologies].first != '')
delete_ontologies_from_object(category_params[:ontologies],category.ontologies,category)
category.update_from_params(category_params)
category_update = category.update
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def update
start = Time.now
begin
group = LinkedData::Client::Models::Group.find_by_acronym(params[:id]).first
add_ontologies_to_object(group_params[:ontologies],group) if (group_params[:ontologies].size > 0 && group_params[:ontologies].first != '')
add_ontologies_to_object(group_params[:ontologies],group) if (group_params[:ontologies].present? && group_params[:ontologies].size > 0 && group_params[:ontologies].first != '')
delete_ontologies_from_object(group_params[:ontologies],group.ontologies,group)
group.update_from_params(group_params)
group_updated = group.update
Expand Down
1 change: 1 addition & 0 deletions app/controllers/concerns/submission_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def add_ontologies_to_object(ontologies,object)
end

def delete_ontologies_from_object(new_ontologies,old_ontologies,object)
new_ontologies = [] if new_ontologies.nil?
ontologies = old_ontologies - new_ontologies
ontologies.each do |ont|
ontology = LinkedData::Client::Models::Ontology.find(ont)
Expand Down

0 comments on commit 4442776

Please sign in to comment.