Skip to content

Commit

Permalink
fixing anime schedule no display bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NoCymer committed Jul 24, 2023
1 parent 5642fc0 commit 7b1d6f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/modules/animeSchedule/AnimeSchedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ const quarterListTwentyFour = [
const scheduleSetting = AnimeScheduleModule
.getSetting("schedule-weekday-entries-array");

// Checks for default value and sanitize it for avoiding unwanted quarter
try {
if(scheduleSetting.value[0]["_quarter"] === -1) {
scheduleSetting.value = [];
}
} catch(e) {}

const timeFormatSetting = appManager
.getSetting("time-format-string");

Expand Down Expand Up @@ -238,7 +245,7 @@ const AnimeScheduleWeek = () => {

const getQuarters = (week, day, timeFormat) => {
return week[day].map((quarter: Anime[]) => {
if (quarter.length <= 1)
if (quarter.length < 1)
return null;
return (
<div
Expand Down Expand Up @@ -271,12 +278,12 @@ const AnimeScheduleWeek = () => {
}

/**
* Checks whether or nat a day has anime to display
* Checks whether or not a day has been loaded
* @param day
* @param week
* @returns True if the day has no anime to display
*/
const isDayEmpty = (day, week) => {
const isDayLoaded = (day, week) => {
for(let quarter in week[day])
if(week[day][quarter].length > 0) return false;
return true;
Expand Down Expand Up @@ -340,7 +347,7 @@ const AnimeScheduleWeek = () => {
>
{
//Iterates over every quarter of each day
isDayEmpty(day, week) ? <span className="loading-wheel"></span> : getQuarters(week, day, timeFormat)
isDayLoaded(day, week) ? <span className="loading-wheel"/> : getQuarters(week, day, timeFormat)
}
</div>)

Expand Down
2 changes: 1 addition & 1 deletion src/modules/animeSchedule/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"_thumbnailURL":"",
"_malURL":"",
"_nextReleaseDate": "2000-01-01T00:00:00.000Z",
"_quarter": 100
"_quarter": -1
}
]
},
Expand Down

0 comments on commit 7b1d6f7

Please sign in to comment.