17
\$\begingroup\$

Assuming StackExchange doesn't decide to restore my account after deleting it due to age restrictions (even though I'm 14 already and almost 15 ಠ_ಠ), a lot of people on this site just lost reputation from my upvotes being deleted. This happened at around 5:30 PM on June 20th, 2017, UTC.

So, your challenge is to show how much PPCG reputation was lost from my deletion, given the user's PPCG ID.

Challenge

Input

A single integer will represent the user's UUID on PPCG.

Output

A single integer will represent how much reputation the user lost due to this. If the user lost reputation multiple times within the same hour all due to user removals, then it is acceptable if your program returns the number for the wrong user. In the event that the user gained reputation from my account being deleted, your program should return a negative number for losing negative reputation. And finally, should I have had no voting on that user (in the past 60 days), your program should return 0.

Test Cases

UUID  -> REP-LOST (Username) # Don't output the username
40695 -> 22 (Downgoat)
12012 -> 148 (Dennis)
8578  -> 61 (Martin Ender)

You can check by going to https://codegolf.stackexchange.com/users/<UUID>/?tab=reputation&sort=post and looking for User was removed (learn more)

Original idea thanks to Uriel with approval

Note

Thanks to JungHwan Min for this link!

https://codegolf.stackexchange.com/ajax/users/<UUID>/rep/day/1497916800

You can fetch raw data of a user's reputation change from this link above.

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Dennis Jun 21 '17 at 3:29
  • 1
    \$\begingroup\$ SE has age restriction? What was it? \$\endgroup\$ – user202729 Oct 15 '17 at 9:43
  • 1
    \$\begingroup\$ @user202729 An account holder must be at least 13 years old. I created my Stack Overflow account when I was 12 but they deleted it when I was almost 15... \$\endgroup\$ – HyperNeutrino Oct 15 '17 at 15:22
8
\$\begingroup\$

JavaScript ES6, 132 bytes

n=>fetch(`/ajax/users/${n}/rep/day/1497916800`).then(v=>v.text()).then(v=>alert((v.match(/rep-down">-(\d+)[^u]+user w/)||[0,0])[1]))

Tested on Safari 10. This uses the new fetch API and alerts the output. This is a function so pass the user id as the argument. This will output 0 for no rep changes.

Must be run on PPCG due to CORS (Cross-origin resource sharing), browsers do not allow JavaScript to perform a web request outside of the current domain.

\$\endgroup\$
  • \$\begingroup\$ FWIW, this is reporting 65 in my case (UUID 58563) although I've lost 75 directly (user was removed) and 20 indirectly (due to the deletion of my answer to Guess the gender). I don't think you need to take these 20 into account but shouldn't it return 75 nonetheless? (That might be a special case, though. The difference comes from the third lost upvote for Guess the gender which was from HyperNeutrino.) \$\endgroup\$ – Arnauld Jun 21 '17 at 6:55
  • 1
    \$\begingroup\$ Wait, requiring that code be run on a specific domain is valid? \$\endgroup\$ – Shaggy Jun 21 '17 at 8:27
  • \$\begingroup\$ @Arnauld the questions appears to ask us how much rep was lost due to the specific "user was removed" event. I'm not sure which you're looking at but when I visit your profile I see -65? \$\endgroup\$ – Downgoat Jun 21 '17 at 13:24
  • \$\begingroup\$ @Shaggy it's like code that needs to be run on a certain OS, it's valid but with JS it's more of a requirement due to CORS. See the last paragraph \$\endgroup\$ – Downgoat Jun 21 '17 at 13:25
  • \$\begingroup\$ :) This is gonna save me so many bytes on challenges that require the retrieval of an external file - happy days. \$\endgroup\$ – Shaggy Jun 21 '17 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.