added limit 1 to number of ENERGY_VALUE points of meter
parent
2e3e38b4b3
commit
2f4831bbd8
|
@ -852,6 +852,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
@ -1851,6 +1852,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
@ -2848,6 +2850,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
|
|
@ -933,18 +933,17 @@ class MeterPointCollection:
|
||||||
cnx.disconnect()
|
cnx.disconnect()
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.POINT_NOT_FOUND')
|
description='API.POINT_NOT_FOUND')
|
||||||
if row[1] == 'ENERGY_VALUE':
|
elif row[1] == 'ENERGY_VALUE':
|
||||||
query = (" SELECT tmp.id,tmp.meter_id,tmp.point_id,tp.object_type "
|
query = (" SELECT p.id "
|
||||||
" FROM tbl_meters_points tmp "
|
" FROM tbl_meters_points mp, tbl_points p "
|
||||||
" LEFT JOIN tbl_points tp ON tmp.point_id = tp.id"
|
" WHERE mp.meter_id = %s AND mp.point_id = p.id AND p.object_type = 'ENERGY_VALUE' ")
|
||||||
" WHERE tmp.meter_id = %s AND tp.object_type = %s")
|
cursor.execute(query, (id_,))
|
||||||
cursor.execute(query, (id_, 'ENERGY_VALUE',))
|
rows_points = cursor.fetchall()
|
||||||
rows = cursor.fetchall()
|
if rows_points is not None and len(rows_points) > 0:
|
||||||
if rows is not None:
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
cnx.disconnect()
|
cnx.disconnect()
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||||
description='API.POINT_OBJECT_TYPE_IS_ALREADY_IN_USE')
|
description='API.METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS')
|
||||||
|
|
||||||
query = (" SELECT id "
|
query = (" SELECT id "
|
||||||
" FROM tbl_meters_points "
|
" FROM tbl_meters_points "
|
||||||
|
|
Loading…
Reference in New Issue