<commit_before>//readingCenterMyBookshelfCtrl.js

ctrls.controller("readingCenterMyBookshelfController", ['$rootScope', '$scope','BookshelfView',
    'Bookshelf','BookInShelf','DropBookFromShelf', 'NoteTake', 'BookDetail', 'Dropzone', 'config', function($rootScope, $scope,BookshelfView,Bookshelf,BookInShelf,DropBookFromShelf,NoteTake, BookDetail, Dropzone, config) {
	$scope.name='阅读中心->我的书架';

    var size = 9;
    var stateTexts = { more : "加载更多",loading: "更多加载中...",nomore: "没有了"};
    $scope.unreadLoading = stateTexts.loading;
    $scope.readLoading = stateTexts.loading;
    // Get the user id form rootScope
    $scope.arguments = {id: $rootScope.id};

    // $scope.BookshelfView = new BookshelfView();
    // $scope.BookshelfView.ShowMoreBooksInShelf($scope.arguments);

    $scope.statuses = [{
        id: 0,
        name:"全部",
        callback: function(){$scope.selectBookAttributes()}
    }, {
        id: 1,
        name: "必读",
        callback: function(){$scope.selectBookAttributes()}
    }, {
        id: 2,
        name: "选读",
        callback: function(){$scope.selectBookAttributes()}
    }];
    $scope.selected_status = 0;

    // //Get books with number of size.
    // var bookInShelf = BookInShelf.get({id:$rootScope.id,page:0,size:size},function(){
    //     console.log(bookInShelf);
    //     //init $scope.readBooks  & $scope.unreadBooks
    //     spileBooksByReadState(bookInShelf.content,$scope.readBooks,$scope.unreadBooks);
    //
    // });
    var unreadBooksALL;
    var readBooksALL;

    $scope.button = {
      "toggle": true,
      "checkbox": {
        "left": false,
        "middle": true,
        "right": false
      },
      "radio": 0
    };

    $scope.show = function(){
      console.log($scope.button.radio);
    }

    $scope.selectBookAttributes = function(){
          unreadBooksALL = new Array();
          readBooksALL = new Array();
        // console.log($scope.selected_status);
        // $scope.bookInShelf = BookInShelf.get({id:$rootScope.id,page:0,size:size},function(){
        var bookshelf = Bookshelf.get({id:$rootScope.id},function(){
          // console.log(bookshelf.booksInShelf);
          $scope.shelf = bookshelf;
          var content = bookshelf.booksInShelf;
          for(var i = 0; i < content.length; i++){
              //console.log(content[i]);
              if(content[i].readState){
                  // if($scope.selected_status=== 1&& !content[i].bookAttribute)
                  //     continue;
                  // if($scope.selected_status=== 2&& content[i].bookAttribute)
                  //     continue;
                  if($scope.button.radio=== 1&& !content[i].bookAttribute)
                      continue;
                  if($scope.button.radio=== 2&& content[i].bookAttribute)
                      continue;
                   readBooksALL.push(content[i]);
              }
              else{
                  // if($scope.selected_status=== 1&& !content[i].bookAttribute)
                  //     continue;
                  // if($scope.selected_status=== 2&& content[i].bookAttribute)
                  //     continue;
                  if($scope.button.radio=== 1&& !content[i].bookAttribute)
                      continue;
                  if($scope.button.radio=== 2&& content[i].bookAttribute)
                      continue;
                   unreadBooksALL.push(content[i]);
              }
          }
          $scope.unreadLoading = setLoadingState(unreadBooksALL,size);
          $scope.readLoading = setLoadingState(readBooksALL,size);

          $scope.unreadBooks = new Array();
          $scope.readBooks = new Array();

          initBooks($scope.unreadBooks,unreadBooksALL,size);
          initBooks($scope.readBooks,readBooksALL,size);
        });
    };

    $scope.unreadBooksLoadingMore = function(){
      if($scope.unreadLoading === stateTexts.nomore)
        return;
      if(loadingMore($scope.unreadBooks,unreadBooksALL,size))
        $scope.unreadLoading = stateTexts.more;
      else{
        $scope.unreadLoading = stateTexts.nomore;
      }
    }
<commit_msg>mybookshelf<commit_after>//readingCenterMyBookshelfCtrl.js

ctrls.controller("readingCenterMyBookshelfController", ['$rootScope', '$scope','BookshelfView',
    'Bookshelf','BookInShelf','DropBookFromShelf', 'NoteTake', 'BookDetail', 'Dropzone', 'config', function($rootScope, $scope,BookshelfView,Bookshelf,BookInShelf,DropBookFromShelf,NoteTake, BookDetail, Dropzone, config) {
	$scope.name='阅读中心->我的书架';

    var size = 9;
    var stateTexts = { more : "加载更多",loading: "更多加载中...",nomore: "没有了"};
    $scope.unreadLoading = stateTexts.loading;
    $scope.readLoading = stateTexts.loading;
    // Get the user id form rootScope
    $scope.arguments = {id: $rootScope.id};

    // $scope.BookshelfView = new BookshelfView();
    // $scope.BookshelfView.ShowMoreBooksInShelf($scope.arguments);

    $scope.statuses = [{
        id: 0,
        name:"全部",
        callback: function(){$scope.selectBookAttributes()}
    }, {
        id: 1,
        name: "必读",
        callback: function(){$scope.selectBookAttributes()}
    }, {
        id: 2,
        name: "选读",
        callback: function(){$scope.selectBookAttributes()}
    }];
    $scope.selected_status = 0;

    // //Get books with number of size.
    // var bookInShelf = BookInShelf.get({id:$rootScope.id,page:0,size:size},function(){
    //     console.log(bookInShelf);
    //     //init $scope.readBooks  & $scope.unreadBooks
    //     spileBooksByReadState(bookInShelf.content,$scope.readBooks,$scope.unreadBooks);
    //
    // });
    var unreadBooksALL;
    var readBooksALL;

    $scope.button = {
      "toggle": true,
      "checkbox": {
        "left": false,
        "middle": true,
        "right": false
      },
      "radio": 0
    };

    $scope.show = function(){
      console.log($scope.button.radio);
    }

    $scope.selectBookAttributes = function(){
          unreadBooksALL = new Array();
          readBooksALL = new Array();
        // console.log($scope.selected_status);
        // $scope.bookInShelf = BookInShelf.get({id:$rootScope.id,page:0,size:size},function(){
        var bookshelf = Bookshelf.get({id:$rootScope.id},function(){
          // console.log(bookshelf.booksInShelf);
          $scope.shelf = bookshelf;
          var content = bookshelf.booksInShelf;
          for(var i = 0; i < content.length; i++){
              //console.log(content[i]);
              if(content[i].readState){
                  if($scope.selected_status=== 1&& !content[i].bookAttribute)
                      continue;
                  if($scope.selected_status=== 2&& content[i].bookAttribute)
                      continue;
                  // if($scope.button.radio=== 1&& !content[i].bookAttribute)
                  //     continue;
                  // if($scope.button.radio=== 2&& content[i].bookAttribute)
                  //     continue;
                   readBooksALL.push(content[i]);
              }
              else{
                  if($scope.selected_status=== 1&& !content[i].bookAttribute)
                      continue;
                  if($scope.selected_status=== 2&& content[i].bookAttribute)
                      continue;
                  // if($scope.button.radio=== 1&& !content[i].bookAttribute)
                  //     continue;
                  // if($scope.button.radio=== 2&& content[i].bookAttribute)
                  //     continue;
                   unreadBooksALL.push(content[i]);
              }
          }
          $scope.unreadLoading = setLoadingState(unreadBooksALL,size);
          $scope.readLoading = setLoadingState(readBooksALL,size);

          $scope.unreadBooks = new Array();
          $scope.readBooks = new Array();

          initBooks($scope.unreadBooks,unreadBooksALL,size);
          initBooks($scope.readBooks,readBooksALL,size);
        });
    };

    $scope.unreadBooksLoadingMore = function(){
      if($scope.unreadLoading === stateTexts.nomore)
        return;
      if(loadingMore($scope.unreadBooks,unreadBooksALL,size))
        $scope.unreadLoading = stateTexts.more;
      else{
        $scope.unreadLoading = stateTexts.nomore;
      }
    }

{'fraction_non_alphanumeric': 0.14793187347931874, 'fraction_numerical': 0.00413625304136253, 'mean_word_length': 2.1558541266794626, 'pattern_counts': {'":': 12, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3114562', 'n_tokens_mistral': 2602, 'n_tokens_neox': 2404, 'n_words': 360}