spencerwooo / substats

( `д′) how many followers do i have? how many!
https://substats.swo.moe
MIT License
813 stars 56 forks source link

Add support for multiple accounts on the same platform #21

Open MiracleXYZ opened 3 years ago

MiracleXYZ commented 3 years ago

Sometimes I need to track total subs of multiple accounts on a single platform. But the current query format

GET /?source={SOURCE}&queryKey={QUERY1}&source={SOURCE}&queryKey={QUERY2} ....

is not working properly. totalSubs is correct, but subsInEachSource only shows the last one. An example is here.

spencerwooo commented 3 years ago

Ok, so:

subsInEachSource only shows the last one.

is because the current implementation overwrites the value for subsInEachSource if multiple queries for the same source is requested, as coded here:

fetchStatsRes.subsInEachSource[res.value.source] = res.value.subs

So how would you propose to implement this? Return an array of numbers in the same sequence as given by the request if there are multiple queries for the same platform?