[Koha-bugs] [Bug 33430] Suggestions.pl with several hundred items causes a slow loading screen

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 6 20:42:00 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33430

Lucas Gass <lucas at bywatersolutions.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lucas at bywatersolutions.com

--- Comment #1 from Lucas Gass <lucas at bywatersolutions.com> ---
For testing purposes in koha-testing-docker I wrote this. Definitely DO NOT add
this to a production server:

$('body').append('<button id="makeSuggestions">Make 100 suggestions</button>');
  $('#makeSuggestions').click( function() {
    for (let i = 0; i < 100; i++) {
      let branches = ["CPL",
"FFL","FPL","FRL","IPT","LPL","MPL","PVL","RPL","SPL","TPL","UPL"];
      let random_branch = Math.floor(Math.random() * branches.length);

      let statuses = ["ASKED", "ACCEPTED", "REJECTED"];
      let random_status = Math.floor(Math.random() * statuses.length);

      let random_title = (Math.random() + 1).toString(36).substring(2);
      $.ajax({
        url: '/api/v1/suggestions',
        method: 'POST',
        data: JSON.stringify({
              "title": random_title,
              "item_type": "BK",
              "suggested_by": Math.floor(Math.random() * 51),
              "suggestion_date": "2023-04-06",
              "timestamp": "2023-04-06T17:59:26+00:00",
              "managed_by": 51,
              "library_id": branches[random_branch],
              "status": statuses[random_status],
      }),
        contentType: 'application/json',
        success: function(result) {
            console.log('suggestion added');
        },
    });
  } 
});

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list