jheidecker / lemmony

A better "All" browsing experience for Lemmy instances
MIT License
45 stars 3 forks source link

continue NOT pass in loop (derp) #6

Closed jheidecker closed 1 year ago

jheidecker commented 1 year ago

not filtering already subbed communities!

drdaeman commented 1 year ago

If I understood what this issue is about correctly, I don't think there's a bug. It should filter. The community is only added to local_community_id_list if its not subscribed to. Writing continue instead of pass here won't make any difference there, as that conditional is the whole body of the loop.

You probably should rewrite the condition to make it easier to read:

for community in actor_resp.json()['communities']:
    if community['subscribed'] != 'Subscribed':
        local_community_id_list.append(community['community']['id'])

(Or something similar if you want to change behavior to e.g. "only unsubscribed" - the snippet above matches the current logic)

jheidecker commented 1 year ago

If I understood what this issue is about correctly, I don't think there's a bug. It should filter. The community is only added to local_community_id_list if its not subscribed to. Writing continue instead of pass here won't make any difference there, as that conditional is the whole body of the loop.

You probably should rewrite the condition to make it easier to read:

for community in actor_resp.json()['communities']:
    if community['subscribed'] != 'Subscribed':
        local_community_id_list.append(community['community']['id'])

(Or something similar if you want to change behavior to e.g. "only unsubscribed" - the snippet above matches the current logic)

PR? :) It's nice getting to say that for a change. No pressure. I am open to all sorts of changes and refactoring. Uber-dev I am not.