Skip to content

Commit

Permalink
1.4.8 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ReStartQ committed Feb 15, 2024
1 parent 0565773 commit 60f2ca2
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/renderer/components/app/etc/ProgressStepper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,48 @@ export default function ProgressStepper({
return valueC;
};

const getEpisodeOrChapterNumberBuffer = (
value: any,
valueC: any,
type: any,
progress: any,
nextAiringEpisode: any,
) => {
if (type === 'ANIME') {
if (value === null) {
const num = Math.ceil(progress / 13);
if (nextAiringEpisode === null && value === null) {
return 0;
}
if (progress >= 1000) {
return 9999;
}
if (progress >= 100) {
return 999;
}
if (progress === 0) {
return 13;
}
return num * 13 + 1;
}
return value;
}
if (valueC === null) {
const num = Math.ceil(progress / 26);
if (progress >= 1000) {
return 9999;
}
if (progress >= 100) {
return 999;
}
if (progress === 0) {
return 13;
}
return num * 26 + 1;
}
return valueC;
};

const normalise = (value: number, valueC: number, type: any) => {
if (type === 'ANIME') {
return (
Expand Down Expand Up @@ -189,11 +231,12 @@ export default function ProgressStepper({
buffer={normalise(
props.nextAiringEpisode !== null
? props.nextAiringEpisode.episode - 1
: getEpisodeOrChapterNumber(
: getEpisodeOrChapterNumberBuffer(
props.episodes,
props.chapters,
props.type,
advancedInput.progress,
props.nextAiringEpisode,
), // this should be episodes or if episodes is null, then default number
props.chapters,
props.type,
Expand Down

0 comments on commit 60f2ca2

Please sign in to comment.