Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
comply with lint errors
  • Loading branch information
sanchegm committed Jul 5, 2024
1 parent 50d5cb7 commit 98fe38e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
12 changes: 8 additions & 4 deletions src/affiliation.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,20 @@ def __init__(
self.clinvar_submitter_ids = clinvar_submitter_ids if clinvar_submitter_ids else ""
self.errors: dict = {}

def save(cls, name, coordinator, coordinator_email, status, type_, family, members, approvers, clinvar_submitter_ids, id_):
@classmethod
def save(cls, values_dict, id_):
"""Save user input to the DB."""
con = sqlite3.connect(DB_FILE) # type: ignore
cur = con.cursor()
logger.info(type(approvers))
try:
query = ("UPDATE affiliations SET name=?, coordinator=?, "
"coordinator_email=?, status=?, type=?, family=?, "
"members=?, approvers=?, clinvar_submitter_ids=? WHERE id=?")
cur.execute(query, (name, coordinator, coordinator_email, status,
type_, family, members, approvers, clinvar_submitter_ids, id_))
cur.execute(query, (values_dict["name"], values_dict["coordinator"],
values_dict["coord_email"], values_dict["status"],
values_dict["type"], values_dict["family"],
values_dict["members"], values_dict["approvers"],
values_dict["clinvar_submitter_ids"], id_))
except sqlite3.Error as err:
logger.error("Unable to update affiliation by ID.")
logger.error("Error code: %s", err.sqlite_errorcode)
Expand Down
24 changes: 12 additions & 12 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ def edit_post(affil_id):
if not affil_id:
return redirect(url_for("index"))
affiliation = Affiliation.get_by_id(affil_id)
if affiliation.save(request.form['name'],
request.form['coordinator'],
request.form['coordinator_email'],
request.form['status'],
request.form['type'],
request.form['family'],
request.form['members'],
request.form['approvers'],
request.form['clinvar_submitter_ids'],
affil_id):
new_values = {"name": request.form['name'],
"coordinator": request.form['coordinator'],
"coord_email": request.form['coordinator_email'],
"status": request.form['status'],
"type": request.form['type'],
"family": request.form['family'],
"members": request.form['members'],
"approvers": request.form['approvers'],
"clinvar_submitter_ids": request.form['clinvar_submitter_ids']
}
if affiliation.save(new_values, affil_id):
flash("Updated Affiliation")
return redirect(url_for("index"))
else:
return render_template("edit.html", affiliation=affiliation)
return render_template("edit.html", affiliation=affiliation)


@app.route("/login", methods=["GET", "POST"])
Expand Down

0 comments on commit 98fe38e

Please sign in to comment.