Skip to content

Fix "similar-code" issue in project/main/same_function_helper.py #96

Description

@SabCampos

The same_function_helper.py file contains multiple functions that are reused all over the API.

CodeClimate has found the following issue:
Similar blocks of code found in 3 locations. Consider refactoring.

def getQhawaxMode(qhawax_name):
    """ Get qHAWAX mode based on name """
    if(qhawaxExistBasedOnName(qhawax_name)):
        return session.query(Qhawax.mode).filter_by(name=qhawax_name).first()[0]
    return None

def getQhawaxName(qhawax_id):
    """ Helper function to get qHAWAX name base on qHAWAX ID """
    if(qhawaxExistBasedOnID(qhawax_id)):
        return session.query(Qhawax.name).filter_by(id =qhawax_id).first()[0]
    return None

def getMainIncaQhawaxTable(qhawax_name):
    """ Helper function to get qHAWAX Main Inca based on qHAWAX name """
    if(qhawaxExistBasedOnName(qhawax_name)):
        return session.query(Qhawax.main_inca).filter_by(name=qhawax_name).first()[0]
    return None

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions