<p dir="auto">Let's suppose you create a block and you set its duration to 12 hours. Then you realize you need to edit this block. You go to <code class="notranslate">/user_blocks/:id/edit</code> and you see among other things a duration select set to 12 hours as expected:<br>
<a href="https://github.com/user-attachments/assets/550707db-160b-405c-a85e-ecd156d5a4a6">image.png (view on web)</a></p>
<p dir="auto">But what if you come an hour later? Now the remaining duration is 11 hours which is not one of the available select options. The select will look like this, defaulting to 0 hours, probably not the best choice:<br>
<a href="https://github.com/user-attachments/assets/6fde232c-a1cb-4f79-83db-b65a308f9a3c">image.png (view on web)</a></p>
<p dir="auto">Here I set the select to the closest available value.</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5011'>https://github.com/openstreetmap/openstreetmap-website/pull/5011</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5011/commits/a3282b8542fa08673c68f72eeaf7d15914e8b6b7" class="commit-link">a3282b8</a> Select closest value to remaining duration when editing a block</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5011/files">2 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5011/files#diff-762e147134aeb7c6c814b6478e6fee8af290b11a6009a242d52fa14cfe3d6db2">app/views/user_blocks/edit.html.erb</a>
(3)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5011/files#diff-9ca0f3412d30fa75d21d710e7d0f07b08a8eeb934543b9db405b8d63619548c1">test/controllers/user_blocks_controller_test.rb</a>
(28)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5011.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5011.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5011.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5011.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5011">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLIARX367V2D6SFIR3LZNUVHTAVCNFSM6AAAAABLIUH4PGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZDGMRUGY4TQMA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLIEYI3U3GBETLTJ42LZNUVHTA5CNFSM6AAAAABLIUH4PGWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHJA36QQQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5011</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5011",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5011",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>