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

Fix off-by-one-error in sat range template #4075

Merged
merged 1 commit into from
Nov 14, 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
4 changes: 2 additions & 2 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3936,7 +3936,7 @@ mod tests {
</dl>
<h2>1 Sat Range</h2>
<ul class=monospace>
<li><a href=/sat/0 class=mythic>0</a>-<a href=/sat/5000000000 class=uncommon>5000000000</a> \\(5000000000 sats\\)</li>
<li><a href=/sat/0 class=mythic>0</a>-<a href=/sat/4999999999 class=common>4999999999</a> \\(5000000000 sats\\)</li>
</ul>.*"
),
);
Expand Down Expand Up @@ -3981,7 +3981,7 @@ mod tests {
</dl>
<h2>1 Sat Range</h2>
<ul class=monospace>
<li><a href=/sat/5000000000 class=uncommon>5000000000</a>-<a href=/sat/10000000000 class=uncommon>10000000000</a> \\(5000000000 sats\\)</li>
<li><a href=/sat/5000000000 class=uncommon>5000000000</a>-<a href=/sat/9999999999 class=common>9999999999</a> \\(5000000000 sats\\)</li>
</ul>.*"
),
);
Expand Down
4 changes: 2 additions & 2 deletions src/templates/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ mod tests {
<h2>2 Sat Ranges</h2>
<ul class=monospace>
<li><a href=/sat/0 class=mythic>0</a></li>
<li><a href=/sat/1 class=common>1</a>-<a href=/sat/3 class=common>3</a> \\(2 sats\\)</li>
<li><a href=/sat/1 class=common>1</a>-<a href=/sat/2 class=common>2</a> \\(2 sats\\)</li>
</ul>
"
.unindent()
Expand Down Expand Up @@ -107,7 +107,7 @@ mod tests {
<h2>2 Sat Ranges</h2>
<ul class=monospace>
<li><a href=/sat/0 class=mythic>0</a></li>
<li><a href=/sat/1 class=common>1</a>-<a href=/sat/3 class=common>3</a> \\(2 sats\\)</li>
<li><a href=/sat/1 class=common>1</a>-<a href=/sat/2 class=common>2</a> \\(2 sats\\)</li>
</ul>
"
.unindent()
Expand Down
3 changes: 2 additions & 1 deletion templates/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ <h2>{{"Sat Range".tally(sat_ranges.len())}}</h2>
<ul class=monospace>
%% for (start, end) in sat_ranges {
%% let value = end - start;
%% let last = end - 1;
%% if value == 1 {
<li><a href=/sat/{{start}} class={{Sat(*start).rarity()}}>{{start}}</a></li>
%% } else {
<li><a href=/sat/{{start}} class={{Sat(*start).rarity()}}>{{start}}</a>-<a href=/sat/{{end}} class={{Sat(*end).rarity()}}>{{end}}</a> ({{value}} sats)</li>
<li><a href=/sat/{{start}} class={{Sat(*start).rarity()}}>{{start}}</a>-<a href=/sat/{{last}} class=common>{{last}}</a> ({{value}} sats)</li>
%% }
%% }
</ul>
Expand Down
Loading