Skip to content

Commit

Permalink
fetch all profiles, even if there are more than 200 profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Vianney Lecroart committed Nov 21, 2014
1 parent 73cb6af commit c075f17
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions server/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Meteor.methods({
}
},

fetchProfiles: function() {
console.log ( "Fetching Meetup Member Profiles ");
fetchProfiles: function(offset) {
var adminRoles = ["Organizer", "Co-Organizer"];

Meteor.call('MeetupAPI', 'getProfiles', {"group_urlname": group_urlname, "fields":"other_services"}, function(err, response) {
offset = offset || 0;

console.log ( "Fetching Meetup Member Profiles offset", offset);

Meteor.call('MeetupAPI', 'getProfiles', {"offset": offset, "page": 200, "group_urlname": group_urlname, "fields":"other_services"}, function(err, response) {
for (var i = 0, l = response.meta.count; i < l; i++) {
var node = response.results[i];

Expand Down Expand Up @@ -93,6 +95,10 @@ Meteor.methods({
}
}
}
// we surely habe more than 200 profiles, get the next page
if(response.meta.count == 200)
Meteor.call("fetchProfiles", offset + 1);

});
},

Expand Down

0 comments on commit c075f17

Please sign in to comment.