mirror of
				https://github.com/scinote-eln/scinote-web.git
				synced 2025-11-04 12:07:23 +08:00 
			
		
		
		
	Fix filtering for checklists, dropdown and status [SCI-6465] (#3802)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
		
							parent
							
								
									7de6d3d566
								
							
						
					
					
						commit
						60859fec4e
					
				
					 5 changed files with 11 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -364,13 +364,13 @@ class RepositoriesController < ApplicationController
 | 
			
		|||
  def assigned_my_modules
 | 
			
		||||
    my_modules = MyModule.joins(:repository_rows).where(repository_rows: { repository: @repository })
 | 
			
		||||
                         .readable_by_user(current_user).distinct
 | 
			
		||||
    render json: grouped_by_prj_exp(my_modules).map { |g|
 | 
			
		||||
                   {
 | 
			
		||||
                     label: "#{g[:project_name]} / #{g[:experiment_name]}", options: g[:tasks].map do |t|
 | 
			
		||||
                       { label: t.name, value: t.id }
 | 
			
		||||
                     end
 | 
			
		||||
                   }
 | 
			
		||||
                 }
 | 
			
		||||
    render json: {data: grouped_by_prj_exp(my_modules).map { |g|
 | 
			
		||||
                          {
 | 
			
		||||
                            label: "#{g[:project_name]} / #{g[:experiment_name]}", options: g[:tasks].map do |t|
 | 
			
		||||
                              { label: t.name, value: t.id }
 | 
			
		||||
                            end
 | 
			
		||||
                          }
 | 
			
		||||
                        } }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def repository_users
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,7 +71,7 @@ window.initRepositoryFilter = () => {
 | 
			
		|||
  });
 | 
			
		||||
 | 
			
		||||
  $.get($('#filterContainer').data('my-modules-url'), function(data) {
 | 
			
		||||
    repositoryFilterContainer.my_modules = data;
 | 
			
		||||
    repositoryFilterContainer.my_modules = data.data;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  $.get($('#filterContainer').data('columns-url'), function(data) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ class RepositoryChecklistValue < ApplicationRecord
 | 
			
		|||
    repository_rows
 | 
			
		||||
      .where(repository_checklist_values: {
 | 
			
		||||
               repository_checklist_items_values: {
 | 
			
		||||
                 repository_checklist_item: { id: filter_element.parameters['item_ids'] }
 | 
			
		||||
                 repository_checklist_items: { id: filter_element.parameters['item_ids'] }
 | 
			
		||||
               }
 | 
			
		||||
             })
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ class RepositoryListValue < ApplicationRecord
 | 
			
		|||
 | 
			
		||||
  def self.add_filter_condition(repository_rows, filter_element)
 | 
			
		||||
    repository_rows
 | 
			
		||||
      .where(repository_list_values: { repository_list_item: { id: filter_element.parameters['item_ids'] } })
 | 
			
		||||
      .where(repository_list_values: { repository_list_items: { id: filter_element.parameters['item_ids'] } })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def data
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ class RepositoryStatusValue < ApplicationRecord
 | 
			
		|||
 | 
			
		||||
  def self.add_filter_condition(repository_rows, filter_element)
 | 
			
		||||
    repository_rows
 | 
			
		||||
      .where(repository_status_values: { repository_status_item: { id: filter_element.parameters['status_ids'] } })
 | 
			
		||||
      .where(repository_status_values: { repository_status_items: { id: filter_element.parameters['status_ids'] } })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def data_changed?(new_data)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue