• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

fetch and update issues loop not updating edge cases

 
Ranch Hand
Posts: 1001
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



I have code like above to fetch and then update the issues.

If I have 200 records it is fetching and updating fine.

If I have 390 records 190 records at the end not getting updated.
I am setting offset to limit (200) at end of loop

New offset increases from 0 to 200
New limit again pushed 200 more.

If the edge case of 190 end record in case of 390 does not work

If the record 640 up to 600 it is updating fine but last 40 records not updating.

If the record 2020 up to 2020 it is updating fine but last 20 edge case records not updating.


I am able to fetch exact count dynamic value as below




How can I fix my edge cases based on above IssuesIntSize  and issueUpdateBatchSize  and IssuesIntSize

i am unable to understand how to modify below for edge case last iteration numbers like 190 ,40, 20 etc.
offset=limit;
Please advise
 
Saloon Keeper
Posts: 11025
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 
sai rama krishna
Ranch Hand
Posts: 1001
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. After this change if I have 490 records it seems doing first 200 and last 90 but not 200 in between some reason.

If I have 660 it is updating 460 but leaving 200 records in middle. I have to run the application one more time to update these remaining 200 as well.



If I have 880 it is updating 680 but leaving 200 records in middle. I have to run the application one more time to update these remaining 200 as well.

I changed to for loop and changed condition from < to <= still same behavior.
Please advise
 
Carey Brown
Saloon Keeper
Posts: 11025
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried putting in print statements for 'offset' and  'limit' to see what the actual values are?
 
Carey Brown
Saloon Keeper
Posts: 11025
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
 
sai rama krishna
Ranch Hand
Posts: 1001
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much.
Where i can find these type of moderate to high complex real time challenges to practice?
(It took 4 days for me to understand think through and modify existing implementation to enhance this type of logic which should Ideally be done in few minutes once I practice these type of challenges daily or more frequently)
 
Carey Brown
Saloon Keeper
Posts: 11025
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might try HackerRank.com. Go to Java section. Exercises start off simple and increase in difficulty.
 
sai rama krishna
Ranch Hand
Posts: 1001
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I will work on those challenges in that same order. If some one gives me idea or code it makes sense to me. But I am taking long time to get ideas and  implementation plan which I am currently working on to improve.
 
reply
    Bookmark Topic Watch Topic
  • New Topic