thejosejorge / futcal-for-scriptable

Futcal is a football widget for Scriptable.
76 stars 25 forks source link

Previous match is showing wrong information #32

Closed j43h4k closed 2 years ago

j43h4k commented 2 years ago

image

hangoon-p commented 2 years ago

Change the code on Line166: const previousMatch = teamData.fixtures[0];

to:

for (let i = 0; i < teamData.fixtures.length; i++) {
    if (teamData.fixtures[i].id === nextMatch.id) {
        var pre_match_id = i - 1;
        break;
    }
}
const previousMatch = teamData.fixtures[pre_match_id];

It will work.

j43h4k commented 2 years ago

YES!!! It works. Thank you very much.

michel0271 commented 2 years ago

I am also seeing incorrect information from the previous game IMG_0552

michel0271 commented 2 years ago

Unfortunately, entering the code doesn't work for me

michel0271 commented 2 years ago

can you help please?

hangoon-p commented 2 years ago

can you help please?

As my comment above, all you need to do is replace the code on Line 166 to my code. It is not pretty, but should work just fine if you did it right. If you did something wrong, I think it wouldn't work with an error message.

I forked thejosejorge's code to my repository to maintain my personal tiny modification. So you may refer it if you are not sure what you have to do. (Compare the whole code in the function 'addWidgetMatches' between thejosejorge's code and mine)

michel0271 commented 2 years ago

can you help please?

As my comment above, all you need to do is replace the code on Line 166 to my code. It is not pretty, but should work just fine if you did it right. If you did something wrong, I think it wouldn't work with an error message.

I forked thejosejorge's code to my repository to maintain my personal tiny modification. So you may refer it if you are not sure what you have to do. (Compare the whole code in the function 'addWidgetMatches' between thejosejorge's code and mine)

on Line 166 i have this IMG_0579

hangoon-p commented 2 years ago

can you help please?

As my comment above, all you need to do is replace the code on Line 166 to my code. It is not pretty, but should work just fine if you did it right. If you did something wrong, I think it wouldn't work with an error message. I forked thejosejorge's code to my repository to maintain my personal tiny modification. So you may refer it if you are not sure what you have to do. (Compare the whole code in the function 'addWidgetMatches' between thejosejorge's code and mine)

on Line 166 i have this IMG_0579

In your case you should look at Line 163. You could’ve see the code not just the number. On my first comment I wrote the both code to change and to replace for you to find and fix it.

michel0271 commented 2 years ago

Thank you, that worked

root-devvoo commented 2 years ago

Thank you so much! I also solved by that solution. :)

thejosejorge commented 2 years ago

Hi guys,

Apologies for the delay on the response! Thanks @hangoon-p, I saw the fix you provided so I was waiting to have other changes in order to update the script. I have incorporated this (API change on Fixtures list) and another fix (API change on League table) in the latest version of the script.

Closing the ticket.

Thanks, José