<p></p>
<p dir="auto">In the calculation for the changeset_comments rate limit, there is a hardcoded value of "200" for deciding if a user is experienced or not.</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/b09fc8373d31751a3d677cc8c3cae714a2280ecd/app/models/user.rb#L414">https://github.com/openstreetmap/openstreetmap-website/blob/b09fc8373d31751a3d677cc8c3cae714a2280ecd/app/models/user.rb#L414</a></p>
<p dir="auto">This has to be matched by the same hardcoded value in the tests</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/b09fc8373d31751a3d677cc8c3cae714a2280ecd/test/controllers/api/changeset_comments_controller_test.rb#L161">https://github.com/openstreetmap/openstreetmap-website/blob/b09fc8373d31751a3d677cc8c3cae714a2280ecd/test/controllers/api/changeset_comments_controller_test.rb#L161</a></p>
<p dir="auto">However, creating 200 dummy changeset comments can take a few seconds. It would be a nice-to-have to allow this value to be overridden, and a lower (faster) value to be used in the test suite. Reducing the value from 200 to 20 reduces that test from 5.6 to 1.6 seconds on my machine.</p>
<p dir="auto">It's also a good idea to avoid magic numbers in the code anyway. It took me a while to figure that the number in the test suite was a specific number, and not just "some arbitrary large number".</p>
<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/issues/4427">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJEYQKQZXPBTWPN4ALYKLJSNAVCNFSM6AAAAABA4XING2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA2TANBUGA3TQMQ">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLKGMQPBD72VA3TWIITYKLJSNA5CNFSM6AAAAABA4XING2WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHHUNZ6JY.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/issues/4427</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/issues/4427",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/4427",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>