Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
[FIX] remove unused code
Browse files Browse the repository at this point in the history
do not create unneeded orderbooks
  • Loading branch information
darkdarkdragon committed Sep 7, 2015
1 parent be30da2 commit c3af328
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 285 deletions.
27 changes: 2 additions & 25 deletions src/js/controllers/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,28 +695,16 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker,
store.set('ripple_pairs_all',require('../data/pairs'));
}

var pairs_all = store.get('ripple_pairs_all');
// var pairs_all = store.get('ripple_pairs_all');
var pairs_default = require('../data/pairs');
$scope.pairs_all = genericUtils.uniqueObjArray(pairs_all, pairs_default, 'name');
$scope.default_trade_pair = pairs_default[0].name;

function compare(a, b) {
if (a.order < b.order) return 1;
if (a.order > b.order) return -1;
return 0;
}

// sort currencies and pairs by order
$scope.currencies_all.sort(compare);

function compare_last_used(a, b) {
var time_a = a.last_used || a.order || 0;
var time_b = b.last_used || b.order || 0;
if (time_a < time_b) return 1;
if (time_a > time_b) return -1;
return 0;
}
$scope.pairs_all.sort(compare_last_used);

$scope.currencies_all_keyed = {};
_.each($scope.currencies_all, function(currency){
$scope.currencies_all_keyed[currency.value] = currency;
Expand All @@ -732,17 +720,6 @@ function AppCtrl ($scope, id, net, keychain, txQueue, appManager, rpTracker,
currenciesAllWatcher();
}, true);

var pairsAllWatcher = $scope.$watch('pairs_all', function(){
if (!$scope.pairs_all.length) return;

if (!store.disabled) {
store.set('ripple_pairs_all',$scope.pairs_all);
}

pairsAllWatcher();
}, true);

$scope.pairs = $scope.pairs_all.slice(1);
$timeout(function() {
$scope.app_loaded = 'loaded';
$("body").removeClass("loading");
Expand Down
Loading

0 comments on commit c3af328

Please sign in to comment.