Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
fix bug with missing pubkey
Browse files Browse the repository at this point in the history
  • Loading branch information
shekenahglory committed Dec 13, 2016
1 parent 94e3e10 commit 1ecb62a
Showing 1 changed file with 36 additions and 28 deletions.
64 changes: 36 additions & 28 deletions src/app/validators/validator.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,74 @@
angular.module( 'ripplecharts.validator', [
'use strict'

angular.module('ripplecharts.validator', [
'ui.state',
'ui.bootstrap',
'ui.route'
])

.config(function config( $stateProvider ) {
.config(function config($stateProvider) {
$stateProvider
.state('validator', {
url: '/validators/:pubkey',
views: {
"main": {
main: {
controller: 'ValidatorCtrl',
templateUrl: 'validators/validator.tpl.html'
}
},
data:{ pageTitle: 'Rippled Validator' }
});
data: {pageTitle: 'Rippled Validator'}
})
})

.controller('ValidatorCtrl', function ValidatorCtrl( $scope, $state, $location) {
var apiHandler = new ApiHandler(API);
.controller('ValidatorCtrl', function ValidatorCtrl($scope, $state) {

if (!$state.params.pubkey) {
$state.transitionTo('validators')
return
}

$scope.reports = [];
$scope.loading = true;
$scope.status = 'Loading...';
var apiHandler = new ApiHandler(API)

$scope.reports = []
$scope.loading = true
$scope.status = 'Loading...'

$scope.validator = {
pubkey: $state.params.pubkey
};
}

apiHandler.getValidator($scope.validator.pubkey, function(err, validator) {
if (err) {
console.log('err');
console.log('err')

} else {
$scope.validator.domain = validator.domain;
$scope.validator.domain_state = validator.domain_state;
$scope.$apply();
$scope.validator.domain = validator.domain
$scope.validator.domain_state = validator.domain_state
$scope.$apply()
}
});
})

apiHandler.getValidatorReports({
pubkey: $scope.validator.pubkey
}, function(err, reports) {
$scope.loading = false;
$scope.status = err || '';
$scope.loading = false
$scope.status = err || ''

if (err) {
console.log(err);
console.log(err)
}

if (reports && reports.length) {
reports.forEach(function(v) {
v.date = moment.utc(v.date)
.format('dddd, MMMM D YYYY');
var disagreement = v.total_ledgers - v.main_net_ledgers;
disagreement /= v.total_ledgers;
v.main_net_disagreement = disagreement.toFixed(5);
});
.format('dddd, MMMM D YYYY')
var disagreement = v.total_ledgers - v.main_net_ledgers
disagreement /= v.total_ledgers
v.main_net_disagreement = disagreement.toFixed(5)
})
}

$scope.reports = reports;
$scope.$apply();
});
});
$scope.reports = reports
$scope.$apply()
})
})

0 comments on commit 1ecb62a

Please sign in to comment.