Code Duplication    Length = 16-16 lines in 6 locations

myems-api/reports/equipmentenergyitem.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]

myems-api/reports/equipmentload.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]

myems-api/reports/equipmentenergycategory.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]

myems-api/reports/equipmentefficiency.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]

myems-api/reports/equipmentoutput.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]

myems-api/reports/equipmentstatistics.py 1 location

@@ 137-152 (lines=16) @@
134
                              " FROM tbl_equipments "
135
                              " WHERE id = %s ", (equipment_id,))
136
        row_equipment = cursor_system.fetchone()
137
        if row_equipment is None:
138
            if cursor_system:
139
                cursor_system.close()
140
            if cnx_system:
141
                cnx_system.disconnect()
142
143
            if cursor_energy:
144
                cursor_energy.close()
145
            if cnx_energy:
146
                cnx_energy.disconnect()
147
148
            if cursor_historical:
149
                cursor_historical.close()
150
            if cnx_historical:
151
                cnx_historical.disconnect()
152
            raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', description='API.EQUIPMENT_NOT_FOUND')
153
154
        equipment = dict()
155
        equipment['id'] = row_equipment[0]