client/state/jetpack-sync/selectors.js
function getSyncProgressPercentage( state, siteId ) {
	const syncStatus = getSyncStatus( state, siteId ),
		queued = get( syncStatus, 'queue' ),
		sent = get( syncStatus, 'sent' ),
		total = get( syncStatus, 'total' ),
		queuedMultiplier = 0.1,
		sentMultiplier = 0.9;

	if ( isPendingSyncStart( state, siteId ) || ! queued || ! sent || ! total ) {
		return 0;
	}

	const countQueued = reduce(
		queued,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const countSent = reduce(
		sent,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const countTotal = reduce(
		total,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const percentQueued = ( countQueued / countTotal ) * queuedMultiplier * 100;
	const percentSent = ( countSent / countTotal ) * sentMultiplier * 100;

	return Math.ceil( percentQueued + percentSent );
}
function getSyncProgressPercentage( state, siteId ) {
	const syncStatus = getSyncStatus( state, siteId ),
		queued = get( syncStatus, 'queue' ),
		sent = get( syncStatus, 'sent' ),
		total = get( syncStatus, 'total' ),
		queuedMultiplier = 0.1,
		sentMultiplier = 0.9;

	if ( isPendingSyncStart( state, siteId ) || ! queued || ! sent || ! total ) {
		return 0;
	}

	const countQueued = reduce(
		queued,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const countSent = reduce(
		sent,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const countTotal = reduce(
		total,
		( sum, value ) => {
			return ( sum += value );
		},
		0
	);

	const percentQueued = ( countQueued / countTotal ) * queuedMultiplier * 100;
	const percentSent = ( countSent / countTotal ) * sentMultiplier * 100;

	return Math.ceil( percentQueued + percentSent );
}
Returns a rounded up percentage the amount of sync completed.
@param  {Object} state    Global state tree
@param  {Number} siteId   Site ID
@return {Number}          The percentage of sync completed, expressed as an integer