Skip to content

Commit

Permalink
Moved flipped from card model to root model
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Nov 23, 2015
1 parent e283cc3 commit dc5686c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .codenvy/project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"builders":{"configs":{}},"mixinTypes":[],"runners":{"configs":{"project:/Copy2%20of%20Apache%202.4%20%20MYSQL%2014.14%20%20PHP%205.6":{"ram":1000,"variables":{"configurationType":"php/web"},"options":{}},"project:/DefaultRunner":{"ram":500,"variables":{"configurationType":"php"},"options":{}}},"default":"project:/DefaultRunner"},"type":"php","attributes":{"language":["php"]}}
{"builders":{"configs":{}},"mixinTypes":["contribution"],"runners":{"configs":{"project:/Copy2%20of%20Apache%202.4%20%20MYSQL%2014.14%20%20PHP%205.6":{"ram":1000,"variables":{"configurationType":"php/web"},"options":{}},"project:/DefaultRunner":{"ram":500,"variables":{"configurationType":"php"},"options":{}}},"default":"project:/DefaultRunner"},"type":"php","attributes":{"contribute_branch":["master"],"contribute_mode":["contribute"],"language":["php"]}}
3 changes: 2 additions & 1 deletion src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<h2>Scrum Online</h2>
Welcome to my little planning poker web app. Use of this app is free of charge for everyone. As a scrum master just start
a named session and invite your team to join you. It is recommended to display the scrum master view on the big screen
(TV or projector) and let everyone else join via smartphone.
(TV or projector) and let everyone else join via smartphone. To join a session just enter the id displayed in the
heading of the scrum master view. For more information please visit my <a href="https://github.com/Toxantron/scrumonline">github repo</a>.
</p>
</article>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function pollVotes($scope, $http) {
$http.get("/polls/current.php?id=" + $scope.id).success(function(response){
$scope.votes = response;
$scope.votes = response.votes;
$scope.flipped = response.flipped;
setTimeout(function(){
pollVotes($scope, $http);
}, 200);
Expand All @@ -14,8 +15,8 @@ function startPoll($scope, $http) {
{
var vote = $scope.votes[index];
vote.placed = false;
vote.flipped = false;
}
$scope.flipped = false;
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/polls/current.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@
$votes[$index++] = UserVote::create($member, $currentPoll);
}

echo json_encode($votes);
$response = new stdClass();
$response->votes = $votes;
$response->flipped = $currentPoll->getResult() > 0;

echo json_encode($response);
7 changes: 0 additions & 7 deletions src/polls/user-vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class UserVote
private function __construct()
{
$this->placed = false;
$this->flipped = false;
$this->value = 0;
}

Expand All @@ -19,9 +18,6 @@ public static function create($member, $currentPoll)
if(is_null($currentPoll))
return $vote;

// Flip cards if poll was completed
$vote->flipped = $currentPoll->getResult() > 0;

// Find matching member in poll
foreach($currentPoll->getVotes() as $candidate)
{
Expand Down Expand Up @@ -51,7 +47,4 @@ public static function create($member, $currentPoll)

// Value of the vote
public $value;

// For ui only
public $flipped;
}
2 changes: 1 addition & 1 deletion src/sessions/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<div data-ng-repeat="vote in votes track by vote.id" class="col-lg-2 col-md-3 col-xs-4">
<div class="card-container">
<div class="card-flip" data-ng-class="{flipped: vote.flipped}">
<div class="card-flip" data-ng-class="{flipped: flipped}">
<div class="card front">
<div data-ng-if="vote.placed" class="inner"><h1>?</h1></div>
</div>
Expand Down

0 comments on commit dc5686c

Please sign in to comment.