Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7848137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:05:44+00:00 2026-06-02T18:05:44+00:00

in order to find an intersection of multiple users’ settings (boolean), I need to

  • 0

in order to find an “intersection” of multiple users’ settings (boolean), I need to compare their setting objects with each other. For example: if you click on a user, you see his settings and can edit them but if you select multiple users which can have different settings, I want to be able to show an indeterminate status in order to display that a specific setting is set to true for some users and to false for others. In case of multi select, the same settings will be applied to all selected users.

Here is an example of what I came up with so far and would like to know if there is a more elegant way to do it (as soon as there is at least two users with different settings, then I can ignore the rest): http://jsfiddle.net/kT7UP/

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:05:46+00:00Added an answer on June 2, 2026 at 6:05 pm

    You can make each property test into a common function where you pass in the property name. So all your repetitive for loops become this:

    function checkCommonValue(prop) {
        for (var j = 0; j < userAll.length; j++) {
            if (userAll[j][prop] != model[prop]) {
                console.log('Indeterminate status');
                return(false);
            }
        }
        return(true);
    }
    
    checkCommonValue("Printing");
    checkCommonValue("Sharing");
    checkCommonValue("Reading");
    checkCommonValue("AccountEnabled");
    checkCommonValue("Fax");
    

    Keep in mind the basic coding principle DRY (don’t repeat yourself). If you find you’re repeating code blocks that are almost the same, then it’s time to think of a way to break that code down into common functions that you can call from multiple places rather than copy/paste the same code into multiple places.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a list of objects with multiple attributes I need to find the list
I have two dendrograms which I wish to compare to each other in order
Suppose we have buyers and sellers that are trying to find each other in
So i am trying to do this Order.find :all, :conditions => org = 'test
I have a Find function in order to find an element from a BST
I am trying to find my java class URL in order to use it
I can find ample evidence that MongoDBs are always kept in the order given
In order to reduce repetition and streamline testing/debugging, I'm trying to find the best
Is there an option to find if my system is little endian byte order
When you do Something.find(array_of_ids) in Rails, the order of the resulting array does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.