@@ -584,11 +584,13 @@ angular.module('mm.addons.mod_data')
584584 * @param {Number } dataId Data ID.
585585 * @param {Number } entryId Entry ID.
586586 * @param {Number } groupId Group ID.
587- * @param {String } siteId Site ID. Current if not defined.
588- * @return {Promise } Containing page number, if has next and have following page.
587+ * @param {Boolean } [forceCache] True to always get the value from cache, false otherwise. Default false.
588+ * @param {Boolean } [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down).
589+ * @param {String } [siteId] Site ID. Current if not defined.
590+ * @return {Promise } Containing page number, if has next and have following page.
589591 */
590- self . getPageInfoByEntry = function ( dataId , entryId , groupId , siteId ) {
591- return self . getAllEntriesIds ( dataId , groupId , siteId ) . then ( function ( entries ) {
592+ self . getPageInfoByEntry = function ( dataId , entryId , groupId , forceCache , ignoreCache , siteId ) {
593+ return self . getAllEntriesIds ( dataId , groupId , forceCache , ignoreCache , siteId ) . then ( function ( entries ) {
592594 for ( var index in entries ) {
593595 if ( entries [ index ] == entryId ) {
594596 index = parseInt ( index , 10 ) ;
@@ -614,11 +616,13 @@ angular.module('mm.addons.mod_data')
614616 * @param {Number } dataId Data ID.
615617 * @param {Number } page Page number.
616618 * @param {Number } groupId Group ID.
617- * @param {String } siteId Site ID. Current if not defined.
618- * @return {Promise } Containing page number, if has next and have following page.
619+ * @param {Boolean } [forceCache] True to always get the value from cache, false otherwise. Default false.
620+ * @param {Boolean } [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down).
621+ * @param {String } [siteId] Site ID. Current if not defined.
622+ * @return {Promise } Containing page number, if has next and have following page.
619623 */
620- self . getPageInfoByPage = function ( dataId , page , groupId , siteId ) {
621- return self . getAllEntriesIds ( dataId , groupId , siteId ) . then ( function ( entries ) {
624+ self . getPageInfoByPage = function ( dataId , page , groupId , forceCache , ignoreCache , siteId ) {
625+ return self . getAllEntriesIds ( dataId , groupId , forceCache , ignoreCache , siteId ) . then ( function ( entries ) {
622626 var index = parseInt ( page , 10 ) - 1 ,
623627 entryId = entries [ index ] ;
624628 if ( entryId ) {
@@ -642,11 +646,13 @@ angular.module('mm.addons.mod_data')
642646 * @name $mmaModDataHelper#getAllEntriesIds
643647 * @param {Number } dataId Data ID.
644648 * @param {Number } groupId Group ID.
645- * @param {String } siteId Site ID. Current if not defined.
646- * @return {Promise } Containing and array of EntryId.
649+ * @param {Boolean } [forceCache] True to always get the value from cache, false otherwise. Default false.
650+ * @param {Boolean } [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down).
651+ * @param {String } [siteId] Site ID. Current if not defined.
652+ * @return {Promise } Resolved with an array of entry ID.
647653 */
648- self . getAllEntriesIds = function ( dataId , groupId , siteId ) {
649- return $mmaModData . fetchAllEntries ( dataId , groupId , undefined , undefined , undefined , true , undefined , undefined , siteId )
654+ self . getAllEntriesIds = function ( dataId , groupId , forceCache , ignoreCache , siteId ) {
655+ return $mmaModData . fetchAllEntries ( dataId , groupId , undefined , undefined , undefined , forceCache , ignoreCache , siteId )
650656 . then ( function ( entries ) {
651657 return entries . map ( function ( entry ) {
652658 return entry . id ;
0 commit comments