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

Once flagged always flagged? #288

Closed
Martii opened this issue Aug 12, 2014 · 8 comments · Fixed by #289
Closed

Once flagged always flagged? #288

Martii opened this issue Aug 12, 2014 · 8 comments · Fixed by #289
Labels
bug You've guessed it... this means a bug is reported.

Comments

@Martii
Copy link
Member

Martii commented Aug 12, 2014

Should flagged then unflagged authors and scripts remain flagged even if the flags count is zero?


I'm thinking this is a bug unless everyone shouldn't be using flagging at all unless they know for certain something is going to the graveyard (in which case why bother flagging) ... otherwise it seems a bit excessive to penalize someone without a chance to remedy the situation... and if they do remedy they are permanently unlisted. :\

@Martii
Copy link
Member Author

Martii commented Aug 12, 2014

Here's another question...

Why are we decrementing the flags count with an up vote?

@sizzlemctwizzle please explain how this is calculated. It seems to me that flagging (flags) should be reserved as a positive whole number only and rating should be the summation of votes e.g.

EDIT:
1 good votes + 1 bad votes + no flags = 0 rating and 0 flags
10 good votes + 1 bad votes + no flags = 9 rating and 0 flags

1 good votes + 0 bad votes + 1 flags = 1 rating and 1 flags
1 good votes + 10 bad votes + no flags = -9 rating and 0 flags


This is really unclear how we calculate this in plain english. I can see everyones confusion especially since it's not documented anywhere.

@Martii
Copy link
Member Author

Martii commented Aug 13, 2014

This alternate code maintains hiding the flagged count if the number of votes outranks the flags but fixes the CSS error with not showing the number of votes as reported here.

  var sumVotesAndFlags = script.votes + script.flags;

  var votesRatio = sumVotesAndFlags > 0 ? script.votes / sumVotesAndFlags : 1;
  var flagsRatio = sumVotesAndFlags > 0 ? script.flags / sumVotesAndFlags : 0;

  var votesPercent = votesRatio * 100;
  var flagsPercent = flagsRatio * 100;

  if (flagsPercent <= 0) {
    votesPercent = script.votes === 0 ? 0 : 100;
    flagsPercent = 0;
  }

  script.votesPercent = votesPercent;
  script.flagsPercent = flagsPercent;

This alternate code allows everyone to see the flags but only gently until the script votes get outranked by the flags... this is useful to see if a script is "going downhill"... and is preferred in my book from all roles currently enabled.

  var sumVotesAndFlags = script.votes + script.flags;

  var votesRatio = sumVotesAndFlags > 0 ? script.votes / sumVotesAndFlags : 1;
  var flagsRatio = sumVotesAndFlags > 0 ? script.flags / sumVotesAndFlags : 0;

  var votesPercent = votesRatio * 100;
  var flagsPercent = flagsRatio * 100;

  if (flagsPercent <= 0) {
    votesPercent = script.votes === 0 ? 0 : (sumVotesAndFlags === 0 ? 100 : Math.abs(flagsPercent) / votesPercent * 100);
    flagsPercent = 0;
  }

  script.votesPercent = votesPercent;
  script.flagsPercent = flagsPercent;

Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Aug 13, 2014
@Martii Martii added bug and removed question labels Aug 13, 2014
Martii pushed a commit to Martii/OpenUserJS.org that referenced this issue Aug 13, 2014
* Apparently this isn't needed with a redirect in express under this context

Inversely applies to OpenUserJS#200 and included in OpenUserJS#288

Tested on dev and target test script on production when deployed is https://openuserjs.org/scripts/TimidScript/%5BTS%5D_Pixiv++

Hopefully this won't need to be backed out but it's small enough to redeploy
@Zren
Copy link
Contributor

Zren commented Aug 15, 2014

The up/down bar was made before I realised flags wasn't flagCount. flags and rating are both calculated values.

Rating goes down if there's upvotes, and goes up by 1 if flagged by a user, and up by 2 if by a script author.

Due to how the code is written, you can flag it as a user, submit a script, and unflag it as a script author causing the rating to go up by 1.

To get the up/down votes, we need to query every single votes (bad). The proper way would be to serialize the up/down vote count in the script model.

Basically the entire voting bar has to be redone.

@Martii
Copy link
Member Author

Martii commented Aug 15, 2014

The proper way would be to serialize the up/down vote count in the script model.

I was thinking this was going to be an issue to correct for #134 as I appended to the comment in the last 24 hours at #134 (comment)

Thanks for the explanation.


Rating goes down if there's upvotes, and goes up by 1 if flagged by a user, and up by 2 if by a script author.

I think you have part of this backwards... on upvotes the flags gets decremented, rating gets incremented. On downvotes flags is unchanged, rating gets incremented. e.g. working as expected... however resetting as mentioned is going to be an issue since we merge some flag votes and some up/down votes... e.g. it will need to be reversed in the algorithm if possible, or alternatively as you stated serialized in the script model (which I assume means part of the JSON object in two separate properties), or AuthAs from a list.

we need to query every single votes (bad)

Not necessarily as I mentioned at #134 (comment).

@jesus2099
Copy link

I have a script with a red flag mostly since its upload…
I am wondering what is going on as I have no clue why it is flagged, by who and when the flag will go away and there is no issue… Maybe a small explanation (in a tooltip at least) could help script writers like me. :)

@Martii
Copy link
Member Author

Martii commented Nov 18, 2014

@jesus2099
#262 dependency ... you can view the current status at #262 (comment) ... as soon as things settle down a bit more sizzle will have a chance to commit his changes... until then... your guess is as good as mine and I noticed it was flagged a few days ago well after you had uploaded it. Sorry.

@jesus2099
Copy link

No problem @Martii, I was just wondering what this red flag meant.
You guys are working on issues that will let some admins fix those flags, if I understand correctly, thanks for the reply. :)

@Martii
Copy link
Member Author

Martii commented Nov 18, 2014

@jesus2099
The current best explanation is at https://openuserjs.org/discuss/Flagging . I'm going as quick as I can with debugging but sometimes we all just need to wait... sucks too.

@Martii Martii mentioned this issue Dec 4, 2014
@Martii Martii removed the needs discussion Blah, blah, blah, wahh, wahh, wahh, etc. label Dec 4, 2014
@OpenUserJS OpenUserJS locked as resolved and limited conversation to collaborators Apr 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug You've guessed it... this means a bug is reported.
Development

Successfully merging a pull request may close this issue.

3 participants