Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full_results flag to user and display in admin users table #17

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
Loading