Skip to content

Commit

Permalink
Add support for fouls and warnings (#338)
Browse files Browse the repository at this point in the history
* track and display fouls and warnings

This feature can be turned on and off in app settings.
The changes to the main page include the addition of an "Add warning" and "Add foul" button, each of which take the user to a page were color, number, infraction, and equal puck for fouls or team warning. The infraction selection button is now also on the create penalty page.
Also on the main page, there is now a button that displays the three most recent warnings issued to each team. If this button is pressed, it will bring the user to a summary page of all warnings and fouls that were recorded in the game. Further work is needed (by Tristan) to have this page take the user to foul or warning edit pages.

* Add ability to edit warnings and fouls

* Don't hide warning and foul buttons during timeout

* Match list orders of fouls and warnings

* Bump crate versions to 0.2.0

* Clippy fixes

* Fix crash after warn/foul edit is canceled

* Fix broken test

---------

Co-authored-by: elsald <elsald@icloud.com>
  • Loading branch information
TristanDebrunner and elsald authored May 23, 2024
1 parent d5a37ba commit 05ff535
Show file tree
Hide file tree
Showing 44 changed files with 6,213 additions and 1,039 deletions.
422 changes: 208 additions & 214 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fonts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fonts"
version = "0.1.5"
version = "0.2.0"
authors = ["Atlantis Sports <maintainers@atlantissports.org>"]
edition = "2021"

Expand Down
6 changes: 3 additions & 3 deletions matrix-drawing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "matrix-drawing"
version = "0.1.5"
version = "0.2.0"
authors = ["Atlantis Sports <maintainers@atlantissports.org>"]
edition = "2021"

Expand All @@ -12,8 +12,8 @@ std = ["arrayvec/std", "serde/std", "uwh-common/std"]
arrayref = "0.3"
arrayvec = { version = "0.7", default-features = false }
embedded-graphics = "0.8"
fonts = { version = "0.1.5", path = "../fonts" }
fonts = { version = "0.2.0", path = "../fonts" }
more-asserts = "0.3"
serde = { version = "1", default-features = false }
serde_derive = "1"
uwh-common = { version = "0.1.5", path = "../uwh-common", default-features = false }
uwh-common = { version = "0.2.0", path = "../uwh-common", default-features = false }
6 changes: 5 additions & 1 deletion matrix-drawing/src/transmitted_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ impl TransmittedData {
mod test {
use super::*;
use arrayvec::ArrayVec;
use uwh_common::game_snapshot::{GamePeriod, PenaltySnapshot, PenaltyTime, TimeoutSnapshot};
use uwh_common::game_snapshot::{
GamePeriod, Infraction, PenaltySnapshot, PenaltyTime, TimeoutSnapshot,
};

#[test]
fn test_serialize_and_desereialize() -> Result<(), Box<dyn std::error::Error>> {
Expand Down Expand Up @@ -79,10 +81,12 @@ mod test {
data.snapshot.b_penalties.push(PenaltySnapshot {
player_number: 1,
time: PenaltyTime::Seconds(48),
infraction: Infraction::Unknown, // infraction is not encoded, so the test will fail with any other value
});
data.snapshot.w_penalties.push(PenaltySnapshot {
player_number: 12,
time: PenaltyTime::Seconds(96),
infraction: Infraction::Unknown, // infraction is not encoded, so the test will fail with any other value
});

test_data(&mut data)?;
Expand Down
2 changes: 1 addition & 1 deletion overlay/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "overlay"
version = "0.1.5"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
7 changes: 4 additions & 3 deletions refbox/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "refbox"
version = "0.1.5"
version = "0.2.0"
description = "UI for Atlantis Sports's Underwater Hockey Refbox"
authors = ["Atlantis Sports <maintainers@atlantissports.org>"]
edition = "2021"
Expand Down Expand Up @@ -44,9 +44,10 @@ time = { version = "0.3", features = ["local-offset", "macros", "serde", "serde-
tokio = { version = "1", features = ["io-util", "macros", "net", "sync", "time"] }
tokio-serial = "5"
toml = "0.8"
uwh-common = { version = "0.1.3", path = "../uwh-common"}
matrix-drawing = { version = "0.1.3", path = "../matrix-drawing"}
uwh-common = { version = "0.2.0", path = "../uwh-common"}
matrix-drawing = { version = "0.2.0", path = "../matrix-drawing"}
web-audio-api = { version = "0.45", default-features = false, features = ["cpal"] }
enum-iterator = "1.5.0"

[target.'cfg(target_os = "linux")'.dependencies]
rppal = "0.18"
Expand Down
1 change: 1 addition & 0 deletions refbox/resources/expand_less.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions refbox/resources/expand_more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions refbox/resources/infractions/delay_of_game.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions refbox/resources/infractions/false_start.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions refbox/resources/infractions/free_arm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 05ff535

Please sign in to comment.