thejosejorge / futcal-for-scriptable

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

No Games Data #43

Open TheBreznsoiza opened 1 year ago

TheBreznsoiza commented 1 year ago

Hey guys anyone else seeing this bug, "no data" on the left where the games should appear?

Standings are okay, seemed that FotMob has changed something again image

matthiasjaekel commented 1 year ago

Hey @DasBlatz, I am facing the same issue. @thejosejorge Can you please have a look? Thanks in advance.

beratgashi commented 1 year ago

Yes, i'm facing this issue for a week now!

Seems that no one hasn't found out a quick fix for this 🙃

hangoon-p commented 1 year ago

I just noticed it and here's the fix.

First of all, you need to find the function named "addWidgetMatches". Based on Jose's code, it starts from line 164.

Then, just replace old code to new one as below.

Old :

async function addWidgetMatches(globalStack) {
    const nextMatch = teamData.nextMatch;

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

NEW :

async function addWidgetMatches(globalStack) {
    const nextMatch = teamData.fixtures.allFixtures.nextMatch;

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

Hope it helps you guys. @DasBlatz @beratgashi @matthiasjaekel

beratgashi commented 1 year ago

@hangoon-p thank youuu man it works perfectly 👏

hangoon-p commented 1 year ago

Guys, After I fixed that error, I found out the match time shows the timezone which your team located. (not your local time.) If you have same problem, follow the instruction below.

First, find the code which you need to change. In Jose's code, it is at Line 202.

const matchDetailsUrl = `${matchDetailsApiUrl}${match.id}`;

If you find it, replace it to the code as below.

const matchDetailsUrl = `${matchDetailsApiUrl}${match.id}&timezone=${userSettings.timeZone}`;

There's a thing left to change.

Find the code to change. (In Jose's, Line 84)

const teamDataApiUrl = encodeURI(`${baseApiUrl}/api/teams?id=${userSettings.teamId}&tab=overview&type=team&timeZone=${userSettings.timeZone}`);

Then replace it to below.

const teamDataApiUrl = encodeURI(`${baseApiUrl}/api/teams?id=${userSettings.teamId}&tab=overview&type=team&timezone=${userSettings.timeZone}`);

It will show right match time in your local timezone.

@DasBlatz @beratgashi @matthiasjaekel

beratgashi commented 1 year ago

Hey @hangoon-p, once again we need your help on fixing the new issue undefined is not an object!

Thanks for your efforts on helping us!

hangoon-p commented 1 year ago

@beratgashi I issued new post for this. In there you can find my solution.

JuJT commented 5 months ago

Now, I have this error : 2024-01-27 18:08:41: Error on line 297:131: TypeError: undefined is not an object (evaluating '(matchDetails.content.matchFacts.infoBox["Match Date"].dateFormatted).replaceAll')

How can I fix that ?