Completes initial work on POCONSOLE-44. Adds table for gauge-off data. Still need to add customizable graphs
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<li ng-class="{active: Page.page() == 'dashboard'}"><a href="/#/"><i class="fa fa-home"></i> Dashboard</a></li>
|
||||
<li ng-class="{active: Page.page() == 'cards'}"><a href="/#/cards"><i class="fa fa-folder-open-o"></i> Cards</a></li>
|
||||
<li ng-class="{active: Page.page() == 'tags'}"><a href="/#/tags"><i class="fa fa-tags"></i> Tags</a></li>
|
||||
<li ng-class="{active: Page.page() == 'docs'}"><a href="/#/docs"><i class="fa fa-folder-open-o"></i> Gauge Off</a></li>
|
||||
<li ng-class="{active: Page.page() == 'gaugeoff'}"><a href="/#/gaugeoff"><i class="fa fa-folder-open-o"></i> Gauge Off</a></li>
|
||||
<li ng-class="{active: Page.page() == 'docs'}"><a href="/#/docs"><i class="fa fa-folder-open-o"></i> Well Test</a></li>
|
||||
<li ng-class="{active: Page.page() == 'docs'}"><a href="/#/docs"><i class="fa fa-folder-open-o"></i> Events</a></li>
|
||||
<li ng-class="{active: Page.page() == 'docs'}"><a href="/#/docs"><i class="fa fa-folder-open-o"></i> Notes</a></li>
|
||||
@@ -86,6 +86,7 @@
|
||||
<script src="js/tagVals.controller.js"></script>
|
||||
<script src="js/tags.controller.js"></script>
|
||||
<script src="js/cards.controller.js"></script>
|
||||
<script src="js/gaugeoff.controller.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
45
flask/app/static/js/gaugeoff.controller.js
Normal file
45
flask/app/static/js/gaugeoff.controller.js
Normal file
@@ -0,0 +1,45 @@
|
||||
poconsole.controller('gaugeOffCtrl',function($scope, Page, $q, $http) {
|
||||
Page.setTitle('Gauge Off');
|
||||
Page.setPage('gaugeoff');
|
||||
var getGaugeOffData = function(page_number){
|
||||
var deferred = $q.defer();
|
||||
$http.get('/api/gauge_off_vals?page='+page_number).success(function(data) {
|
||||
deferred.resolve(data);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
$scope.loadGaugeOffData = function(page_number){
|
||||
var getData = getGaugeOffData(page_number);
|
||||
getData.then(function(d){
|
||||
console.log(d);
|
||||
for(var j = 0; j < d.objects.length; j++){
|
||||
d.objects[j].created_on = Date.create(d.objects[j].created_on);
|
||||
}
|
||||
$scope.gauge_off_vals = d.objects.reverse();
|
||||
$scope.num_pages = d.total_pages;
|
||||
$scope.page_list = [];
|
||||
$scope.page_num = d.page;
|
||||
|
||||
if ($scope.page_num < $scope.num_pages){
|
||||
$scope.page_num_next = $scope.page_num + 1;
|
||||
} else {
|
||||
$scope.page_num_next = $scope.num_pages;
|
||||
}
|
||||
|
||||
if ($scope.page_num > 1){
|
||||
$scope.page_num_prev = $scope.page_num - 1;
|
||||
} else {
|
||||
$scope.page_num_prev = 1;
|
||||
}
|
||||
|
||||
for(var i = 1; i <= $scope.num_pages; i++){
|
||||
$scope.page_list.push(i);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.loadGaugeOffData(1);
|
||||
|
||||
|
||||
});
|
||||
@@ -22,6 +22,9 @@ tagserver.config([
|
||||
}).when('/cards/:cardID', {
|
||||
templateUrl: '/templates/card.html',
|
||||
controller: 'cardDataCtrl'
|
||||
}).when('/gaugeoff', {
|
||||
templateUrl: '/templates/gaugeoff.html',
|
||||
controller: 'gaugeOffCtrl'
|
||||
}).when('/', {
|
||||
templateUrl: '/templates/dashboard.html',
|
||||
controller: 'dashboardCtrl'
|
||||
|
||||
67
flask/app/static/templates/gaugeOff.html
Normal file
67
flask/app/static/templates/gaugeOff.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<div class='container'>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>Well History</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<div ng-if="num_pages>1" style="text-align:center;">
|
||||
<ul class="pagination">
|
||||
<li>
|
||||
<a ng-click="loadGaugeOffData(page_num_prev)" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ng-repeat="p in page_list" ng-class="{'active':p==page_num}"><a ng-click="loadGaugeOffData(p)">{{p}}</a></li>
|
||||
<li>
|
||||
<a ng-click="loadGaugeOffData(page_num_next)" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>% Run</th>
|
||||
<th>kWh</th>
|
||||
<th>kWh Regen</th>
|
||||
<th>Cost to Operate</th>
|
||||
<th>Lifting Cost</th>
|
||||
<th>Peak Load</th>
|
||||
<th>Min. Load</th>
|
||||
<th>Average SPM</th>
|
||||
<th>Calc. Production</th>
|
||||
<th>Polished Rod HP</th>
|
||||
<th>Fluid Level</th>
|
||||
<th>Pump Intake Pressure</th>
|
||||
<th>Inflow Rate</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="entry in gauge_off_vals">
|
||||
<td nowrap>{{ entry.created_on | date: 'medium'}}</td>
|
||||
<td nowrap>{{ entry.percent_run | number: 1 }} %</td>
|
||||
<td nowrap>{{ entry.kWh_used_total | number: 2 }} kWh</td>
|
||||
<td nowrap>{{ entry.kWh_regen_total | number: 2 }} kWh</td>
|
||||
<td nowrap>${{ entry.electricity_cost_total | number: 2 }}</td>
|
||||
<td nowrap>${{ entry.lifting_cost_average | number: 2 }}</td>
|
||||
<td nowrap>{{ entry.peak_pr_load | number: 2 }} lbs</td>
|
||||
<td nowrap>{{ entry.min_pr_load | number: 2 }} lbs</td>
|
||||
<td nowrap>{{ entry.spm_average | number: 3 }} SPM</td>
|
||||
<td nowrap>{{ entry.production_total | number: 1 }} BBL</td>
|
||||
<td nowrap>{{ entry.polished_rod_hp_average | number: 2 }} HP</td>
|
||||
<td nowrap>{{ entry.fluid_level_average | number: 1 }} ft.</td>
|
||||
<td nowrap>{{ entry.pump_intake_pressure_average | number: 1 }} PSI</td>
|
||||
<td nowrap>{{ entry.inflow_rate_average | number: 1 }} BBL/hr</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -84,22 +84,13 @@ def get_data(db_table, obj_id):
|
||||
|
||||
class TestStroke(unittest.TestCase):
|
||||
def test_insert(self):
|
||||
# _id = db.Column(db.Integer, primary_key=True)
|
||||
# stroke_type = db.Column(db.String(32))
|
||||
# stroke_number = db.Column(db.String(32))
|
||||
# surf_pos = db.Column(db.Text)
|
||||
# surf_lod = db.Column(db.Text)
|
||||
# down_pos = db.Column(db.Text)
|
||||
# down_lod = db.Column(db.Text)
|
||||
# created_on = db.Column(db.DateTime(), default=datetime.utcnow)
|
||||
# updated_on = db.Column(db.DateTime(), default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
test_card = {
|
||||
'stroke_type': 'normal',
|
||||
'stroke_number': 123,
|
||||
'surf_pos': '[0.0, 90.0, 100.0, 25.0]',
|
||||
'surf_lod': '[15000.0, 20000.0, 20000.0, 15000.0]',
|
||||
'down_pos': '[0.0, 0.0, 100.0, 100.0]',
|
||||
'down_lod': '[-10000.0, -5000.0, -5000.0, -10000.0]'
|
||||
'surf_pos': '[0.0, 90.0, 100.0, 25.0, 0.0]',
|
||||
'surf_lod': '[15000.0, 20000.0, 20000.0, 15000.0, 15000.0]',
|
||||
'down_pos': '[0.0, 0.0, 100.0, 100.0, 0.0]',
|
||||
'down_lod': '[-10000.0, -5000.0, -5000.0, -10000.0, -10000.0]'
|
||||
}
|
||||
id_added = insert_data("cards", test_card)
|
||||
print("Added tag at _id {}".format(id_added))
|
||||
@@ -110,6 +101,38 @@ class TestStroke(unittest.TestCase):
|
||||
print("testing {}: {} == {}".format(x, test_card[x], stroke_in_db[x]))
|
||||
self.assertTrue(test_card[x] == stroke_in_db[x])
|
||||
|
||||
class TestGaugeOff(unittest.TestCase):
|
||||
def test_insert(self):
|
||||
test_gauge_date = {
|
||||
'spm_average': 7.5,
|
||||
'downhole_gross_stroke_average': 98.7,
|
||||
'downhole_net_stroke_average': 92.1,
|
||||
'electricity_cost_total': 10.55,
|
||||
'fluid_level_average': 1034.5,
|
||||
'full_card_production_total': 750.5,
|
||||
'inflow_rate_average': 100.2,
|
||||
'kWh_used_total': 800.23,
|
||||
'kWh_regen_total': 105.3,
|
||||
'lifting_cost_average': 9.34,
|
||||
'peak_pr_load':25098.2,
|
||||
'min_pr_load': 12125.9,
|
||||
'percent_run': 87.4,
|
||||
'polished_rod_hp_average': 2.345,
|
||||
'pump_hp_average': 3.315,
|
||||
'production_total': 517.0,
|
||||
'pump_intake_pressure_average': 500.433,
|
||||
'surface_stroke_length_average': 101.1,
|
||||
'tubing_movement_average': 0.764
|
||||
}
|
||||
id_added = insert_data("gauge_off_vals", test_gauge_date)
|
||||
print("Added tag at _id {}".format(id_added))
|
||||
|
||||
if id_added > 0:
|
||||
go_in_db = get_data("gauge_off_vals", id_added)
|
||||
for x in test_gauge_date:
|
||||
print("testing {}: {} == {}".format(x, test_gauge_date[x], go_in_db[x]))
|
||||
self.assertTrue(test_gauge_date[x] == go_in_db[x])
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user