IgorTimofeev / MineOS

Home of MineOS and it's software for OpenComputers mod
Other
733 stars 191 forks source link

App Market API is review helpful votes doesn't always match up with listed total #599

Closed CoolCat467 closed 3 months ago

CoolCat467 commented 3 months ago

Why is it that reviews market api endpoint has conflicting data about number of helpful votes sometimes? For example, review id 216 says following:

{
    comment="fe",
    rating=4,
    timestamp=1521012231,
    user_name="Parlocameon",
    votes={
        negative=0,
        positive=1,
        total=5
    }
}

Votes says there are 1 positive vote and 0 negative votes, but somehow total is 5 votes? Does that mean there were 4 votes that were deleted or something?

IgorTimofeev commented 3 months ago

Where did you found "negative" field? The reviews endpoint query code is

SELECT
  reviews.id,
  reviews.rating,
  reviews.comment,
  UNIX_TIMESTAMP(reviews.timestamp) AS `timestamp`,

  users.name AS user_name,

  (
    SELECT CONCAT(
      '{total=',
      COUNT(reviews_votes.rating),
      ', positive=',
      SUM(reviews_votes.rating),
      '}'
    )
    FROM reviews_votes
    WHERE reviews_votes.review_id = reviews.id
  ) AS votes
FROM
  reviews
  LEFT JOIN users ON reviews.user_id = users.id
  LEFT JOIN publications ON reviews.publication_id = publications.id
  LEFT JOIN files ON file_id = files.id
WHERE files.id = $fileID
ORDER BY reviews.id DESC
LIMIT $offset, $count

Response for MineCode:

{success=true,result={[1]={id=1614,user_name="CACKE",rating=5,comment="Иконка имба",timestamp=1711642113},[2]={id=1451,user_name="matveyminer",rating=5,comment="Идеально!",timestamp=1690707383,votes={total=1,positive=1}},[3]={id=1382,user_name="mikinl",rating=3,comment="Если удалить последний символ в строке программа вылетает и не сохраняется",timestamp=1672877067,votes={total=1,positive=1}},[4]={id=1154,user_name="kogtyv",rating=5,comment="В новой версии возможно писать только тогда, когда переустановиш ОС.",timestamp=1625739246,votes={total=1,positive=1}},[5]={id=645,user_name="Pidorok",rating=5,comment="Cool app! Bro!",timestamp=1548267037,votes={total=1,positive=1}},[6]={id=573,user_name="Fronun",rating=5,comment="лучше чем команда edit, она удобная это плюс а вторых не прПриложение удобная, ещё сделали оконный режим, это удобно, хочется чтобы можно было сделать свои шаблоны, ибо приходится снова писать local GUI = require(\"GUI\")",timestamp=1539850574,votes={total=1,positive=0}},[7]={id=550,user_name="Xylic",rating=5,comment="Оконный режим, кстати, удобнее фуллскрина, за эт спасибо. Хотя я еще бы не отказался от автогенерации по типу require либ и шаблонов for ... do",timestamp=1536841157,votes={total=1,positive=1}},[8]={id=479,user_name="WattanaGaming",rating=3,comment="this program is somewhat a big ass memory hogger when loading up a big file. and it need some more feature like autocomplete and support for other language(Seriously it need this). but at the time its very good except at editing plain text",timestamp=1529596315,votes={total=1,positive=1}},[9]={id=463,user_name="FederAndInk",rating=4,comment="Really cool :) but ctrl+z is missing :P",timestamp=1527539245,votes={total=2,positive=2}},[10]={id=41,user_name="RamzesTheSecond",rating=5,comment="Красивенько",timestamp=1517160518,votes={total=2,positive=2}},[11]={id=30,user_name="ZPMPowered",rating=5,comment="Фига во что майн превратился! Эх, вернуться что ли на Баттекс?",timestamp=1516531784,votes={total=2,positive=2}},[12]={id=29,user_name="EndDJ",rating=5,comment="А мне нрав <3",timestamp=1516531784,votes={total=2,positive=2}},[13]={id=28,user_name="Pirnogion",rating=5,comment="ебать",timestamp=1516531784,votes={total=3,positive=1}}}}

Btw API is non-opensource, shitty-coded, and no further help with it will be provided. So if you need, do reverse engineering by yourself xd

CoolCat467 commented 3 months ago

Thank you, sorry, I should have looked closer into the actual response on my end instead of making assumptions.