Skip to content

Commit

Permalink
Fixes mutex lock
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbrain-za committed Dec 10, 2023
1 parent 05db0c1 commit 9d16236
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "challenge_frontend"
version = "2.2.5"
version = "2.2.6"
edition = "2021"
rust-version = "1.71"
authors = ["Philip Barlow"]
Expand Down
12 changes: 10 additions & 2 deletions src/apps/binary_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ impl super::View for BinaryUpload {
ui.separator();

if ui.button(self.run.filename.clone()).clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
let sender = self.binary_channel.0.clone();
let task = rfd::AsyncFileDialog::new().pick_file();
execute(async move {
Expand All @@ -145,7 +149,11 @@ impl super::View for BinaryUpload {
if "Select Binary" != &self.run.filename {
ui.separator();
if ui.button("Submit").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
match self.run.validate() {
Ok(_) => {
self.submit();
Expand Down
6 changes: 5 additions & 1 deletion src/apps/challenge_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ impl super::View for ChallengeInfoApp {
}
ui.separator();
if ui.button("Refresh").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
self.active_challenge = None;
}
});
Expand Down
12 changes: 10 additions & 2 deletions src/apps/code_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ impl super::View for CodeEditor {
ui.vertical(|ui| {
if ui.button("Submit").clicked() {
log::debug!("Submitting code");
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
self.as_submission();
match self.run.validate() {
Ok(_) => {
Expand All @@ -175,7 +179,11 @@ impl super::View for CodeEditor {
}
if ui.button("Test").clicked() {
log::debug!("Testing code");
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
self.as_test_submission();
match self.run.validate() {
Ok(_) => {
Expand Down
6 changes: 0 additions & 6 deletions src/apps/login_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ impl LoginApp {
ui.horizontal(|ui| {
ui.vertical(|ui| {
if ui.button("Logout").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.submit_logout()
}
});
Expand Down Expand Up @@ -344,20 +343,17 @@ impl LoginApp {
ui.horizontal(|ui| {
ui.vertical(|ui| {
if ui.button("Login").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.submit_login();
}
});
ui.vertical(|ui| {
if ui.button("Forgot Password").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.submit_forgot_password();
}
});
ui.separator();
ui.vertical(|ui| {
if ui.button("Register").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.register = RegisterSchema::default();
self.state = LoginAppState::RegisterNewUser;
}
Expand Down Expand Up @@ -404,7 +400,6 @@ impl LoginApp {
ui.horizontal(|ui| {
ui.vertical(|ui| {
if ui.button("Register").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
if self.register.password != self.register.confirm_password {
self.toasts
.error("Passwords do not match")
Expand Down Expand Up @@ -433,7 +428,6 @@ impl LoginApp {
ui.separator();
ui.vertical(|ui| {
if ui.button("Cancel").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.register = RegisterSchema::default();
self.state = LoginAppState::Login;
}
Expand Down
1 change: 0 additions & 1 deletion src/apps/password_reset_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ impl PasswordResetApp {
ui.separator();
ui.horizontal(|ui| {
if ui.button("Submit").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
if self.new_password != self.confirm_password {
self.toasts
.error("Passwords do not match")
Expand Down
6 changes: 5 additions & 1 deletion src/apps/scoreboard_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ impl super::View for ScoreBoardApp {
);
ui.separator();
if ui.button("Refresh").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
self.fetch();
}
});
Expand Down
12 changes: 10 additions & 2 deletions src/code_editor/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ impl CodeEditor {
});
ui.separator();
if ui.button("Submit").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
log::debug!("Submitting code");
self.run.test = false;
self.run.code = Some(self.code.clone());
Expand All @@ -182,7 +186,11 @@ impl CodeEditor {
}
}
if ui.button("Test").clicked() {
self.app_state.lock().unwrap().update_activity_timer();
self.app_state
.clone()
.lock()
.unwrap()
.update_activity_timer();
self.run.test = true;
self.run.code = Some(self.code.clone());
self.run.challenge = Some(self.selected_challenge.clone());
Expand Down

0 comments on commit 9d16236

Please sign in to comment.