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

added blockheight to SVG #477

Merged
merged 6 commits into from
Sep 7, 2022
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
7 changes: 5 additions & 2 deletions src/subcommand/server/templates/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::*;

#[derive(Display)]
pub(crate) struct ClockSvg {
height: Height,
hour: f64,
minute: f64,
second: f64,
Expand All @@ -12,6 +13,7 @@ impl ClockSvg {
let min = height.min(Epoch::FIRST_POST_SUBSIDY.starting_height());

Self {
height,
hour: (min.n() % Epoch::FIRST_POST_SUBSIDY.starting_height().n()) as f64
/ Epoch::FIRST_POST_SUBSIDY.starting_height().n() as f64
* 360.0,
Expand Down Expand Up @@ -81,10 +83,11 @@ mod tests {
}

#[test]
fn foo_svg() {
fn clock_svg() {
assert_regex_match!(
ClockSvg::new(Height(6929999)).to_string(),
r##"<svg.*<line y2="-9" transform="rotate\(359.9999480519481\)"/>
r##"<svg.*<text.*>6929999</text>.*
<line y2="-9" transform="rotate\(359.9999480519481\)"/>
<line y2="-13" stroke-width="0.6" transform="rotate\(359.9982857142857\)"/>
<line y2="-16" stroke="#d00505" stroke-width="0.2" transform="rotate\(179.82142857142858\)"/>.*</svg>
"##,
Expand Down
1 change: 1 addition & 0 deletions templates/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.