Skip to content

Commit

Permalink
Show output size on output page (ordinals#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Oct 2, 2022
1 parent dcd9569 commit 9ae26b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,9 @@ mod tests {
"/output/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0",
StatusCode::OK,
".*<title>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</title>.*<h1>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</h1>
<dl>
<dt>size</dt><dd>5000000000</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
<li><a href=/range/0/5000000000 class=mythic>\\[0,5000000000\\)</a></li>
Expand Down
3 changes: 3 additions & 0 deletions src/subcommand/server/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ mod tests {
.to_string(),
"
<h1>Output 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0</h1>
<dl>
<dt>size</dt><dd>2</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
<li><a href=/range/0/1 class=mythic>[0,1)</a></li>
Expand Down
3 changes: 3 additions & 0 deletions templates/output.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<h1>Output {{self.outpoint}}</h1>
%% match &self.list {
%% List::Unspent(ranges) => {
<dl>
<dt>size</dt><dd>{{ranges.iter().map(|(start, end)| end - start).sum::<u64>()}}</dd>
</dl>
<h2>Ordinal Ranges</h2>
<ul class=monospace>
%% for (start, end) in ranges {
Expand Down

0 comments on commit 9ae26b5

Please sign in to comment.