Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ChrisBoesch/singpathfire
Browse files Browse the repository at this point in the history
…into ChrisBoesch-master

# Conflicts:
#	src/shared/components/sign/sign-view.html
#	src/shared/components/sign/sign.js
  • Loading branch information
blueset committed Aug 16, 2015
2 parents e08e86d + c174364 commit c616c98
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 1,206 deletions.
1 change: 0 additions & 1 deletion src/classmentors.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ <h1 class="md-toolbar-tools">
<script src="shared/components/countries/countries.js"></script>
<script src="shared/components/icons/icons.js"></script>
<script src="shared/components/navbar/navbar.js"></script>
<script src="shared/components/schools/schools.js"></script>
<script src="shared/components/sign/sign.js"></script>
<!-- Add Singpath Fire scripts above -->
<!-- endbuild -->
Expand Down
10 changes: 9 additions & 1 deletion src/classmentors/components/events/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,20 +693,28 @@
};

this.completed = function(taskId, participants, progress) {
var participantCount;
var participantCount, participantsIds;

if (!participants || !progress) {
return 0;
}

participantCount = participants.length;
participantsIds = participants.reduce(function(all, participant) {
if (participant.$id) {
all[participant.$id] = true;
}
return all;
}, {});

if (participantCount < 1) {
return 0;
}

return Object.keys(progress).filter(function(publicId) {
return (
participantsIds[publicId] && // Make sure user is still participating
// (user progress is kept when they leave)
progress[publicId] &&
progress[publicId][taskId] &&
progress[publicId][taskId].completed
Expand Down
13 changes: 9 additions & 4 deletions src/classmentors/components/events/events.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,19 @@
it('should return percentage of participants having completed the task', function() {
var ctrl = $controller('ViewEventCtrl', deps);

ctrl.participants = [{}, {}];
ctrl.participants = [{$id: 'bob'}, {$id: 'alice'}];
ctrl.participants.$id = 'eventId';

ctrl.progress = {
someParticipantId: {
someTaskId: {completed: true}
bob: {
someTaskId: {completed: true},
someOtherTaskId: {completed: true}
},
alice: {
someOtherTaskId: {completed: true}
},
someOtherParticipantId: {
tom: {
someTaskId: {completed: true},
someOtherTaskId: {completed: true}
}
};
Expand Down
12 changes: 12 additions & 0 deletions src/shared/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,18 @@
}
]);

module.factory('spfSchools', [
'$q',
'spfFirebase',
function spfSchoolsFactory($q, spfFirebase) {
var promise = spfFirebase.loadedObj(['classMentors/schools']);

return function spfSchools() {
return promise;
};
}
]);

module.provider('spfCrypto', [
function cryptoProvider() {
var saltSize = 128 / 8;
Expand Down
Loading

0 comments on commit c616c98

Please sign in to comment.