Skip to content
TORNLIFE More

API v2/faction/attacks

Started by Grance [3487987] on in Bugs & Issues.

2 replies · 23 views · thread synced · 7 days ago · View on torn.com
About this thread

Posts archived: 3 / 3 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
3
Discussion span
→
People posting
3
Likes on archived posts
4
Posts by staff, officers and moderators
2
Authority score
55 / 100
Historical score
31 / 100
Story score
34 / 100
Engagement score
39 / 100

Most-liked replies

Grance [3487987]

Hello, 

 

Here is what I did: 

 

Step 1: Fetched all attacks via v2 Attack and _meta prev. link. 

Step 2: .json to .db (don't add if violating prim key) <- maybe something went wrong here... (but let's pretend it didn't)

 

Step 3:

select attacker_id and sum( respect_gain) as Score

where attacker_faction_id = 12345 and defender_faction_id = 23456 and is_ranked_war = "true" 

group by attacker_id

 

Now I should have the scores for the ranked war, shouldn't I? 

However, after comparing, I can say, that I haven't for all. For some I had the correct score for others I had not. 

 

What was my intention: I wanted to make a more sophisticated payout-calculator than those, that are available atm. 

 

 

Edit: I did the calculation with the .json (I removed double entries) and came to the same scores. So there are now four options:

 

a) Something is wrong with with the api .

b) Something is wrong with how you calculate the score.

c) You calculate the score in another way. (But your formular is the correct one) 

d) I made a misstake, I haven't found yet. 

Edit 2: I am pretty sure https://api.torn.com/v2/faction/attacks somehow doesn't fetch all attacks. 
I used this code to fetch all attacks: https://we.tl/t-DaVKcUdvsH 

 

Edit 3: I could confirm my suspicion. I used attacksfull to fetch the attacks and calculate the score and now I came to the war score.

splent [2088243] Admin Staff

Hey, 

It looks like I forgot to update this thread a few days ago. 

I think I fixed the issue with some attacks missing when using _meta prev/next links.
The issue happened because meta links were relying on "started" timestamp where the DB queries itself have to use "ended" timestamp due to our DB structure.

If you do notice attacks missing again, please do let me know so I can take a look again!

Thank you!