File tree Expand file tree Collapse file tree 1 file changed +44
-1
lines changed
src/renderer/components/app/etc Expand file tree Collapse file tree 1 file changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,48 @@ export default function ProgressStepper({
5656 return valueC ;
5757 } ;
5858
59+ const getEpisodeOrChapterNumberBuffer = (
60+ value : any ,
61+ valueC : any ,
62+ type : any ,
63+ progress : any ,
64+ nextAiringEpisode : any ,
65+ ) => {
66+ if ( type === 'ANIME' ) {
67+ if ( value === null ) {
68+ const num = Math . ceil ( progress / 13 ) ;
69+ if ( nextAiringEpisode === null && value === null ) {
70+ return 0 ;
71+ }
72+ if ( progress >= 1000 ) {
73+ return 9999 ;
74+ }
75+ if ( progress >= 100 ) {
76+ return 999 ;
77+ }
78+ if ( progress === 0 ) {
79+ return 13 ;
80+ }
81+ return num * 13 + 1 ;
82+ }
83+ return value ;
84+ }
85+ if ( valueC === null ) {
86+ const num = Math . ceil ( progress / 26 ) ;
87+ if ( progress >= 1000 ) {
88+ return 9999 ;
89+ }
90+ if ( progress >= 100 ) {
91+ return 999 ;
92+ }
93+ if ( progress === 0 ) {
94+ return 13 ;
95+ }
96+ return num * 26 + 1 ;
97+ }
98+ return valueC ;
99+ } ;
100+
59101 const normalise = ( value : number , valueC : number , type : any ) => {
60102 if ( type === 'ANIME' ) {
61103 return (
@@ -189,11 +231,12 @@ export default function ProgressStepper({
189231 buffer = { normalise (
190232 props . nextAiringEpisode !== null
191233 ? props . nextAiringEpisode . episode - 1
192- : getEpisodeOrChapterNumber (
234+ : getEpisodeOrChapterNumberBuffer (
193235 props . episodes ,
194236 props . chapters ,
195237 props . type ,
196238 advancedInput . progress ,
239+ props . nextAiringEpisode ,
197240 ) , // this should be episodes or if episodes is null, then default number
198241 props . chapters ,
199242 props . type ,
You can’t perform that action at this time.
0 commit comments