JogoShugh / CoderDojoPonceSprings.TicTacToe

Build Tic Tac Toe in HTML, CSS, and JavaScript -- from beginner to advanced
MIT License
0 stars 1 forks source link

Clicking X to close a single game actually closes MULTIPLE games #1

Closed JogoShugh closed 10 years ago

JogoShugh commented 10 years ago

Noticed this today after I added this new feature.

Steps to reproduce

1) Login as mogo / mogo in Firefox 2) Login as kogo / kogo in Chrome 3) Create a new game as mogo in FF 4) Click Challenge as kogo in Chrome 5) Create another new game as mogo 6) kogo Challenge that game 7) Play out the game. Doesn't matter who wins 8) As mogo, click the "X" that appears when the game finishes 9) Expected behavior: it should remove ONLY that game 10) Actual behavior: it removes both games! Boo

Possible Issue

I think the issue is somewhere in this code of ng-tic-chat-toe.js:

    $scope.gameClose = function(game) {
      for(var i = 0; i < gamesActive.length; i++) {
        if (gamesActive[i] === game) {
          gamesActive.splice(i);
        }
      }
    };

Link: https://github.com/JogoShugh/CoderDojoPonceSprings.TicTacToe/blob/master/vNext/js/ng-tic-chat-toe.js#L421-L428

JogoShugh commented 10 years ago

Alex, like to try to knock out this bug? I've created a branch for you called close_game_bug. Can you work off that branch for now? If you don't know how to do that, I can help you.

alexthorsrud commented 10 years ago

Ok I'll check it out, see if there's a way to fix it. I already have an idea.

On Sunday, November 10, 2013, Josh Gough wrote:

Alex, like to try to knock out this bug? I've created a branch for you called close_game_bug. Can you work off that branch for now? If you don't know how to do that, I can help you.

— Reply to this email directly or view it on GitHubhttps://github.com/JogoShugh/CoderDojoPonceSprings.TicTacToe/issues/1#issuecomment-28152597 .

Alex

JogoShugh commented 10 years ago

Awesome!

Also, I added to Readme.md instructions for "contributing" on Windows, including automated scripts for installing Chocolatey , git, and Node .. I know you use Mac, so I am going to create an issue for adding instructions and scripts for mac or Linux users. If you would like to tackle that too, then we can arrange for you to do a demo and help other kids next time to start learning git and stuff. On Nov 10, 2013 10:23 AM, "Alex" notifications@github.com wrote:

Ok I'll check it out, see if there's a way to fix it. I already have an idea.

On Sunday, November 10, 2013, Josh Gough wrote:

Alex, like to try to knock out this bug? I've created a branch for you called close_game_bug. Can you work off that branch for now? If you don't know how to do that, I can help you.

— Reply to this email directly or view it on GitHub< https://github.com/JogoShugh/CoderDojoPonceSprings.TicTacToe/issues/1#issuecomment-28152597>

.

Alex

— Reply to this email directly or view it on GitHubhttps://github.com/JogoShugh/CoderDojoPonceSprings.TicTacToe/issues/1#issuecomment-28152639 .

alexthorsrud commented 10 years ago

Ok. I'll use Homebrew (Mac version of Chocolatey basically) to automate installation of git and node.

JogoShugh commented 10 years ago

Looks like splice call needs ,1 added to it. I've been making a lot changes in http://plnkr.co/edit/VrS7JlRikba84qoS1AAK?p=preview, and found that out there.

JogoShugh commented 10 years ago

I have implemented this, along with a lot of other improvements, and they are visible at http://jogoshugh.github.io/CoderDojoPonceSprings.TicTacToe/vNext/