Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching 1:1 with odd number of team members? Will one user be exluded? #72

Closed
ulflunqvist opened this issue May 28, 2020 · 7 comments
Closed

Comments

@ulflunqvist
Copy link

ulflunqvist commented May 28, 2020

  1. Is it possible to see if user have paused the bot?
  2. If odd team member count, do one user get excluded from a match? Is it possible to see who?
@ulflunqvist ulflunqvist changed the title 1:1? Matching 1:1 with odd number of team members? Will one user be exluded? May 28, 2020
@velduz
Copy link

velduz commented Jun 1, 2020

Yes, one user will be excluded, and he will not be notified about it.
I want to make a change and pull request to change that behavior

@rashmi-dixit
Copy link

  1. Yes it's possible to see, check the Users table in the Azure Comos DB. Kindly refer https://github.com/OfficeDev/microsoft-teams-icebreaker-app/wiki/Data-stores
    for details on data stores.
  2. Yes, one user gets excluded. The bot logs a few kinds of custom events to Azure Application Insights. For details visit below link. Use the information provided to calculate key metrics.
    https://github.com/OfficeDev/microsoft-teams-icebreaker-app/wiki/Telemetry

@madshaun1984
Copy link

A simple alternative behaviour to this could be,

If Users = Odd, randomly select 1 user and append them to the end of the User list, making the list even, but subject to one users getting two suggestions.

In ../IcebreakerBot.cs

private List<Tuple<ChannelAccount, ChannelAccount>> MakePairs(List<ChannelAccount> users)
        {
            if (users.Count > 1)
            {
                this.telemetryClient.TrackTrace($"Making {users.Count / 2} pairs among {users.Count} users");
            }
            else
            {
                this.telemetryClient.TrackTrace($"Pairs could not be made because there is only 1 user in the team");
            }

            // If an odd number of users, randomly select then append one user to make an even list 
            if (users.Count % 2 != 0)
            {
                var random = new Random().Next(1, users.Count);
                users.Add(users[random]);
            }

            this.Randomize(users);

            var pairs = new List<Tuple<ChannelAccount, ChannelAccount>>();
            for (int i = 0; i < users.Count - 1; i += 2)
            {
                pairs.Add(new Tuple<ChannelAccount, ChannelAccount>(users[i], users[i + 1]));
            }

            return pairs;
        } 

@robwales
Copy link

robwales commented Oct 9, 2020

A simple alternative behaviour to this could be,

If Users = Odd, randomly select 1 user and append them to the end of the User list, making the list even, but subject to one users getting two suggestions.

In ../IcebreakerBot.cs

private List<Tuple<ChannelAccount, ChannelAccount>> MakePairs(List<ChannelAccount> users)
        {
            if (users.Count > 1)
            {
                this.telemetryClient.TrackTrace($"Making {users.Count / 2} pairs among {users.Count} users");
            }
            else
            {
                this.telemetryClient.TrackTrace($"Pairs could not be made because there is only 1 user in the team");
            }

            // If an odd number of users, randomly select then append one user to make an even list 
            if (users.Count % 2 != 0)
            {
                var random = new Random().Next(1, users.Count);
                users.Add(users[random]);
            }

            this.Randomize(users);

            var pairs = new List<Tuple<ChannelAccount, ChannelAccount>>();
            for (int i = 0; i < users.Count - 1; i += 2)
            {
                pairs.Add(new Tuple<ChannelAccount, ChannelAccount>(users[i], users[i + 1]));
            }

            return pairs;
        } 

Could you let me know where I would access this please?

Thank you

markusd1984 pushed a commit to markusd1984/microsoft-teams-apps-icebreaker that referenced this issue Mar 24, 2021
If Users = Odd, randomly select 1 user and append them to the end of the User list, making the list even, but subject to one users getting two suggestions.

OfficeDev#72 (comment)
@markusd1984
Copy link

markusd1984 commented Mar 24, 2021

@madshaun1984

Thanks for sharing, do we just need to add this in IcebreakerBot.cs after private void LogActivityTelemetry(Activity activity) or does it has to be called somewhere?

@madshaun1984
Copy link

madshaun1984 commented Mar 24, 2021

Finding and replacing the existing "MakePairs" method on line 192 of "MatchingService.cs" should do the trick.

Although please check an alternative to this suggestion hasn't been added elsewhere, its been a while since I've looked at this project.

@markusd1984
Copy link

markusd1984 commented Mar 25, 2021

@madshaun1984 oh I see now you must have just accidentally referenced the wrong file initially, instead of IceBrakerBot.cs the code changes you suggested relate to MatchingService.cs which I can now recognise and make sense, cheers.

it's on line 192 in the main branch but for v2/main it's on line 259.

The additional code to insert that you suggested is:

// If an odd number of users, randomly select then append one user to make an even list 
            if (users.Count % 2 != 0)
            {
                var random = new Random().Next(1, users.Count);
                users.Add(users[random]);
            }

I had another search for "uneven" / "even" related issues but found nothing, this seems to be the only post dealing with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants