Ask HN: I have 10 yrs of Exp. Failed 4 takehome projects. What am I doing wrong?
There&#x27;s some nitpicky bits (like how &quot;utils.py contains two utility functions&quot; is then followed by _three_ bullet points :P ) but one big one that jumped out was using &quot;zrank&quot; to get the new score.<p>That&#x27;s not going to return the right value most of the time - for instance, in the example from the docs at <a href="https:&#x2F;&#x2F;redis.io&#x2F;docs&#x2F;data-types&#x2F;sorted-sets&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;redis.io&#x2F;docs&#x2F;data-types&#x2F;sorted-sets&#x2F;</a> has this:<p><pre><code>    zrank hackers &quot;Anita Borg&quot; is 4
</code></pre>
but &quot;Anita Borg&quot;&#x27;s score is 1949. The operation you likely wanted was &quot;zscore&quot;.<p>It would be straightforward to check this, either manually or in an automated test - simulate hitting &quot;&#x2F;api&#x2F;abc&#x2F;&quot; once and &quot;&#x2F;api&#x2F;xyz&#x2F;&quot; three times. The result of 3 of the 4 requests will be wrong:<p><pre><code>    for &#x2F;api&#x2F;abc&#x2F;: will have count=0 because &#x2F;api&#x2F;abc&#x2F; is the only entry in the sorted set
    first one for &#x2F;api&#x2F;xyz&#x2F; will have count=1 because &#x2F;api&#x2F;abc&#x2F; sorts before &#x2F;api&#x2F;xyz&#x2F; and they both have a score of 1
    second one for &#x2F;api&#x2F;xyz&#x2F; will have count=1 because &#x2F;api&#x2F;xyz&#x2F; has a higher score than &#x2F;api&#x2F;abc&#x2F;
    third one for &#x2F;api&#x2F;xyz&#x2F; will have count=1 because that&#x27;s still true
</code></pre>
Now, it&#x27;s true that the assignment didn&#x27;t say anything about what the service should return: you might have done better on this assignment by returning HTTP 204 and an empty body.<p>IMO when a &quot;super senior &#x2F; staff engineer&quot; chooses to write code, they should write WORKING CODE and verify that that&#x27;s true.