Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove the getSiteStatsPostsCountByDay selector
It's not used anywhere.
  • Loading branch information
jsnajdr committed Jan 18, 2018
commit 74788dfc878175542ab8f41d99603f8e10017ba1
14 changes: 0 additions & 14 deletions client/state/stats/lists/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,6 @@ export const getSiteStatsPostStreakData = treeSelect(
}
);

/**
* Returns a number representing the posts made during a day for a given query
*
* @param {Object} state Global state tree
* @param {Number} siteId Site ID
* @param {Object} query Stats query object
* @param {String} date Date in YYYY-MM-DD format
* @return {?Number} Number of posts made on date
*/
export function getSiteStatsPostsCountByDay( state, siteId, query, date ) {
const data = getSiteStatsPostStreakData( state, siteId, query );
return data[ date ] || null;
}

/**
* Returns normalized stats data for a given query and stat type, or the un-normalized response
* from the API if no normalizer method for that stats type exists in ./utils
Expand Down
49 changes: 0 additions & 49 deletions client/state/stats/lists/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { expect } from 'chai';
import {
getSiteStatsForQuery,
getSiteStatsPostStreakData,
getSiteStatsPostsCountByDay,
getSiteStatsNormalizedData,
isRequestingSiteStatsForQuery,
getSiteStatsCSVData,
Expand Down Expand Up @@ -360,54 +359,6 @@ describe( 'selectors', () => {
} );
} );

describe( 'getSiteStatsPostsCountByDay()', () => {
test( 'should return null if no matching query results exist', () => {
const stats = getSiteStatsPostsCountByDay(
{
stats: {
lists: {
items: {},
},
},
},
2916284,
{},
'2016-06-01'
);

expect( stats ).to.be.null;
} );

test( 'should properly correct number of max posts for a day', () => {
const stats = getSiteStatsPostsCountByDay(
{
stats: {
lists: {
items: {
2916284: {
statsStreak: {
'[["endDate","2016-06-01"],["startDate","2015-06-01"]]': {
data: {
1461889800: 1, // 2016-04-29 00:30:00 (UTC)
1461972600: 1, // 2016-04-29 23:30:00 (UTC)
1462059000: 1, // 2016-04-30 23:30:00 (UTC)
},
},
},
},
},
},
},
},
2916284,
{ startDate: '2015-06-01', endDate: '2016-06-01' },
'2016-04-29'
);

expect( stats ).to.eql( 2 );
} );
} );

describe( 'getSiteStatsNormalizedData()', () => {
test( 'should return null if no matching query results exist', () => {
const stats = getSiteStatsNormalizedData(
Expand Down