@@ -8,52 +8,53 @@ var window, global = {};
88
99 var modules = { } ;
1010 var cache = { } ;
11- var aliases = { } ;
1211 var has = ( { } ) . hasOwnProperty ;
1312
13+ var aliases = { } ;
14+
1415 var endsWith = function ( str , suffix ) {
1516 return str . indexOf ( suffix , str . length - suffix . length ) !== - 1 ;
1617 } ;
1718
18- var _cmp = 'components/' ;
1919 var unalias = function ( alias , loaderPath ) {
2020 var start = 0 ;
2121 if ( loaderPath ) {
22- if ( loaderPath . indexOf ( _cmp ) === 0 ) {
23- start = _cmp . length ;
22+ if ( loaderPath . indexOf ( 'components/' === 0 ) ) {
23+ start = 'components/' . length ;
2424 }
2525 if ( loaderPath . indexOf ( '/' , start ) > 0 ) {
2626 loaderPath = loaderPath . substring ( start , loaderPath . indexOf ( '/' , start ) ) ;
2727 }
2828 }
2929 var result = aliases [ alias + '/index.js' ] || aliases [ loaderPath + '/deps/' + alias + '/index.js' ] ;
3030 if ( result ) {
31- return _cmp + result . substring ( 0 , result . length - '.js' . length ) ;
31+ return 'components/' + result . substring ( 0 , result . length - '.js' . length ) ;
3232 }
3333 return alias ;
3434 } ;
3535
36- var _reg = / ^ \. \. ? ( \/ | $ ) / ;
37- var expand = function ( root , name ) {
38- var results = [ ] , part ;
39- var parts = ( _reg . test ( name ) ? root + '/' + name : name ) . split ( '/' ) ;
40- for ( var i = 0 , length = parts . length ; i < length ; i ++ ) {
41- part = parts [ i ] ;
42- if ( part === '..' ) {
43- results . pop ( ) ;
44- } else if ( part !== '.' && part !== '' ) {
45- results . push ( part ) ;
36+ var expand = ( function ( ) {
37+ var reg = / ^ \. \. ? ( \/ | $ ) / ;
38+ return function ( root , name ) {
39+ var results = [ ] , parts , part ;
40+ parts = ( reg . test ( name ) ? root + '/' + name : name ) . split ( '/' ) ;
41+ for ( var i = 0 , length = parts . length ; i < length ; i ++ ) {
42+ part = parts [ i ] ;
43+ if ( part === '..' ) {
44+ results . pop ( ) ;
45+ } else if ( part !== '.' && part !== '' ) {
46+ results . push ( part ) ;
47+ }
4648 }
47- }
48- return results . join ( '/' ) ;
49- } ;
50-
49+ return results . join ( '/' ) ;
50+ } ;
51+ } ) ( ) ;
5152 var dirname = function ( path ) {
5253 return path . split ( '/' ) . slice ( 0 , - 1 ) . join ( '/' ) ;
5354 } ;
5455
5556 var localRequire = function ( path ) {
56- return function expanded ( name ) {
57+ return function ( name ) {
5758 var absolute = expand ( dirname ( path ) , name ) ;
5859 return globals . require ( absolute , path ) ;
5960 } ;
@@ -108,7 +109,6 @@ var window, global = {};
108109 } ;
109110
110111 require . brunch = true ;
111- require . _cache = cache ;
112112 globals . require = require ;
113113} ) ( ) ;
114114var require = global . require ;
@@ -4392,8 +4392,19 @@ modifySDK = function(sdk) {
43924392 var toRemove ;
43934393 toRemove = statistic . statisticData . slice ( ) ;
43944394 toRemove . push . apply ( toRemove , statistic . eventStatistics ) ;
4395+ toRemove . push . apply ( toRemove , statistic . memberStatistics ) ;
4396+ toRemove . push . apply ( toRemove , statistic . teamStatistics ) ;
4397+ toRemove . push . apply ( toRemove , statistic . statisticAggregates ) ;
43954398 linking . unlinkItems ( toRemove , lookup ) ;
4396- return deleteStatistic . call ( this , statistic ) . fail ( function ( err ) {
4399+ return deleteStatistic . call ( this , statistic ) . then ( function ( result ) {
4400+ var bulkLoadTypes , statisticId , teamId ;
4401+ teamId = statistic . teamId ;
4402+ statisticId = result . id ;
4403+ bulkLoadTypes = [ 'memberStatistic' , 'teamStatistic' , 'statisticAggregate' , 'eventStatistic' ] ;
4404+ return sdk . bulkLoad ( teamId , bulkLoadTypes ) . then ( function ( ) {
4405+ return result ;
4406+ } ) ;
4407+ } ) . fail ( function ( err ) {
43974408 linking . linkItems ( toRemove , lookup ) ;
43984409 return err ;
43994410 } ) . callback ( callback ) ;
@@ -4408,10 +4419,8 @@ modifySDK = function(sdk) {
44084419 var bulkLoadTypes , statisticId , teamId ;
44094420 teamId = statistic . teamId ;
44104421 statisticId = result . id ;
4411- bulkLoadTypes = [ 'memberStatistic' , 'teamStatistic' , 'statisticAggregate' , 'statistic' , 'statisticGroup' ] ;
4412- return promises . when ( sdk . bulkLoad ( teamId , bulkLoadTypes ) , sdk . loadEventStatistics ( {
4413- statisticId : statisticId
4414- } ) ) . then ( function ( ) {
4422+ bulkLoadTypes = [ 'memberStatistic' , 'teamStatistic' , 'statisticAggregate' , 'statistic' , 'statisticGroup' , 'eventStatistic' ] ;
4423+ return sdk . bulkLoad ( teamId , bulkLoadTypes ) . then ( function ( ) {
44154424 return result ;
44164425 } ) ;
44174426 } ) . callback ( callback ) ;
@@ -4420,14 +4429,11 @@ modifySDK = function(sdk) {
44204429 wrapMethod ( sdk , 'bulkSaveStatisticData' , function ( bulkSaveStatisticData ) {
44214430 return function ( templates , callback ) {
44224431 return bulkSaveStatisticData . call ( this , templates , callback ) . then ( function ( result ) {
4423- var bulkLoadTypes , statisticId , teamId ;
4432+ var bulkLoadTypes , teamId ;
44244433 if ( ( result [ 0 ] != null ) && ( result [ 0 ] . teamId != null ) ) {
44254434 teamId = result [ 0 ] . teamId ;
4426- statisticId = result [ 0 ] . statisticId ;
4427- bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' ] ;
4428- return promises . when ( sdk . bulkLoad ( teamId , bulkLoadTypes ) , sdk . loadEventStatistics ( {
4429- statisticId : statisticId
4430- } ) ) . then ( function ( ) {
4435+ bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' , 'eventStatistic' ] ;
4436+ return sdk . bulkLoad ( teamId , bulkLoadTypes ) . then ( function ( ) {
44314437 return result ;
44324438 } ) ;
44334439 }
@@ -4440,10 +4446,8 @@ modifySDK = function(sdk) {
44404446 var bulkLoadTypes , statisticId , teamId ;
44414447 teamId = result . teamId ;
44424448 statisticId = result . statisticId ;
4443- bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' ] ;
4444- return promises . when ( sdk . bulkLoad ( teamId , bulkLoadTypes ) , sdk . loadEventStatistics ( {
4445- statisticId : statisticId
4446- } ) ) . then ( function ( ) {
4449+ bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' , 'eventStatistic' ] ;
4450+ return sdk . bulkLoad ( teamId , bulkLoadTypes ) . then ( function ( ) {
44474451 return result ;
44484452 } ) ;
44494453 } ) . callback ( callback ) ;
@@ -4463,10 +4467,10 @@ modifySDK = function(sdk) {
44634467 }
44644468 linking . unlinkItems ( toRemove , lookup ) ;
44654469 return bulkDeleteStatisticData . call ( this , member , event ) . then ( function ( result ) {
4466- var bulkLoadTypes , eventId , teamId ;
4467- return promises . when ( teamId = member . teamId , eventId = event . id , bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' ] , sdk . bulkLoad ( teamId , bulkLoadTypes ) , sdk . loadEventStatistics ( {
4468- eventId : eventId
4469- } ) ) . then ( function ( ) {
4470+ var bulkLoadTypes , teamId ;
4471+ teamId = member . teamId ;
4472+ bulkLoadTypes = [ 'memberStatistic' , 'statisticAggregate' , 'eventStatistic' ] ;
4473+ return sdk . bulkLoad ( teamId , bulkLoadTypes ) . then ( function ( ) {
44704474 return result ;
44714475 } ) ;
44724476 } ) . fail ( function ( err ) {
@@ -5745,7 +5749,7 @@ ref = require('./model'), Collection = ref.Collection, Item = ref.Item;
57455749require ( './errors' ) ;
57465750
57475751TeamSnap = ( function ( ) {
5748- TeamSnap . prototype . version = '1.7.4 ' ;
5752+ TeamSnap . prototype . version = '1.7.5 ' ;
57495753
57505754 TeamSnap . prototype . promises = promises ;
57515755
0 commit comments