 async = require 'async'
 mongoose = require 'mongoose'
 Handler = require '../commons/Handler'
+AnalyticsLogEvent = require '../analytics/AnalyticsLogEvent'
 Clan = require './Clan'
 EarnedAchievement = require '../achievements/EarnedAchievement'
 EarnedAchievementHandler = require '../achievements/earned_achievement_handler'

        User.update {_id: memberID}, {$pull: {clans: clanID}}, (err) =>
          return @sendDatabaseError(res, err) if err
          @sendSuccess(res)

module.exports = new ClanHandler()

        User.update {_id: req.user._id}, {$pull: {clans: clanID}}, (err) =>
          return @sendDatabaseError(res, err) if err
          @sendSuccess(res)
          AnalyticsLogEvent.logEvent req.user, 'Clan left', clanID: clanID, type: clan.get('type')

  getMemberAchievements: (req, res, clanID) ->
    # TODO: add tests
