Skip to content

Commit

Permalink
Merge pull request #17 from ssciwr/fix_4_full_results_flag_for_use
Browse files Browse the repository at this point in the history
Add full_results flag to user and display in admin users table
  • Loading branch information
lkeegan authored Oct 2, 2024
2 parents a8a42d8 + 0d94b11 commit bf008fa
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/predicTCR_server/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class User(db.Model):
last_submission_timestamp: int = db.Column(db.Integer, nullable=False)
is_admin: bool = db.Column(db.Boolean, nullable=False)
is_runner: bool = db.Column(db.Boolean, nullable=False)
full_results: bool = db.Column(db.Boolean, nullable=False)

def set_password_nocheck(self, new_password: str):
self.password_hash = ph.hash(new_password)
Expand Down Expand Up @@ -102,6 +103,7 @@ def as_dict(self):
"last_submission_timestamp": self.last_submission_timestamp,
"is_admin": self.is_admin,
"is_runner": self.is_runner,
"full_results": self.full_results,
}


Expand Down Expand Up @@ -238,6 +240,7 @@ def add_new_user(email: str, password: str, is_admin: bool) -> tuple[str, int]:
last_submission_timestamp=0,
is_admin=is_admin,
is_runner=False,
full_results=False,
)
)
db.session.commit()
Expand Down Expand Up @@ -272,6 +275,7 @@ def add_new_runner_user() -> User | None:
last_submission_timestamp=0,
is_admin=False,
is_runner=True,
full_results=False,
)
)
db.session.commit()
Expand All @@ -295,7 +299,7 @@ def enable_user(email: str, enabled: bool) -> tuple[str, int]:
user.activated = True
user.enabled = enabled
db.session.commit()
return f"Account {email} activated", 200
return f"Account {email} activated and enabled", 200


def activate_user(token: str) -> tuple[str, int]:
Expand Down
1 change: 1 addition & 0 deletions backend/tests/helpers/flask_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def add_test_users(app):
last_submission_timestamp=0,
is_admin=is_admin,
is_runner=is_runner,
full_results=False,
)
)
db.session.commit()
Expand Down
Binary file removed frontend/public/splash.png
Binary file not shown.
2 changes: 2 additions & 0 deletions frontend/src/components/UsersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function disable_user(user_email: string) {
<fwb-table-head-cell>Email</fwb-table-head-cell>
<fwb-table-head-cell>Activated</fwb-table-head-cell>
<fwb-table-head-cell>Enabled</fwb-table-head-cell>
<fwb-table-head-cell>Full results</fwb-table-head-cell>
<fwb-table-head-cell>Quota</fwb-table-head-cell>
<fwb-table-head-cell>Last submission</fwb-table-head-cell>
<fwb-table-head-cell>Admin</fwb-table-head-cell>
Expand All @@ -91,6 +92,7 @@ function disable_user(user_email: string) {
<fwb-table-cell>{{ user.email }}</fwb-table-cell>
<fwb-table-cell>{{ user.activated ? "✓" : "✗" }}</fwb-table-cell>
<fwb-table-cell>{{ user.enabled ? "✓" : "✗" }}</fwb-table-cell>
<fwb-table-cell>{{ user.full_results ? "✓" : "✗" }}</fwb-table-cell>
<fwb-table-cell>{{ user.quota }}</fwb-table-cell>
<fwb-table-cell>
{{
Expand Down
1 change: 1 addition & 0 deletions frontend/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export type User = {
last_submission_timestamp: number;
is_admin: boolean;
is_runner: boolean;
full_results: boolean;
};

0 comments on commit bf008fa

Please sign in to comment.