KendallDoesCoding / mogul-christmas

Ludwig Ahgren made a Christmas Album in 2020. I just thought of a project cause I was bored where you can play all the songs by a click of a button which you can already do from his timestamps but what makes it special is that it has lyrics of those songs too and a bunch of other features.
https://kendalldoescoding.tech/mogulchristmas
Creative Commons Zero v1.0 Universal
23 stars 62 forks source link

[MAJOR BUG] Only 5 urls out of the 21 consted are working for the You May Like directory, and the other 16 songs are not taking to the proper url. #314

Closed KendallDoesCoding closed 2 years ago

KendallDoesCoding commented 2 years ago

Only 5 urls in the order of the first page got consted and only those 5 songs are playing no matter which button you tap on which page.

Issue starts from the 2-5th page.

PLEASE FIX AT THE EARLIEST @TechStudent10 AS THIS IS A MAJOR BUG

KendallDoesCoding commented 2 years ago

@TechStudent10 please let me know asap

TechStudent10 commented 2 years ago

The code base has changed so much I'm not sure if I'll be able to identify the source of the bug.

TechStudent10 commented 2 years ago

Okay I've identified the bug, but I can't fix it rn. Maybe later.

For anyone wondering, inside of you-may-like/index.js, we have this:

function DisplayList(items, wrapper, rows_per_page, page) {
  wrapper.innerHTML = "";
  page--;

  let start = rows_per_page * page;
  let end = start + rows_per_page;
  let paginatedItems = items.slice(start, end);

  for (let i = 0; i < paginatedItems.length; i++) {
    let item = paginatedItems[i];

    let item_element = document.createElement("div");
    item_element.classList.add("item");
    item_element.innerText = item;
    let link = links[i]
    item_element.addEventListener("click", (e) => {
      window.open(link, "_blank")
    })

    wrapper.appendChild(item_element);
  }
}

This is what displays the list. The issue is that instead of adding the page number to i when we search for the links, it always goes from the first index. In layman's terms: we are updating the contents of the list, but not the links themselves. If someone wants to give a crack at this, here you go. Otherwise I should be able to fix this later.

vivsh1999 commented 2 years ago

Let me know if it's available to work on. @KendallDoesCoding

KendallDoesCoding commented 2 years ago

It is, indeed!

On Sun, 4 Sept 2022 at 13:25, Vivek Sharma @.***> wrote:

Let me know if it's available to work on. @KendallDoesCoding https://github.com/KendallDoesCoding

— Reply to this email directly, view it on GitHub https://github.com/KendallDoesCoding/mogul-christmas/issues/314#issuecomment-1236282395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUGJUTNB2TMYIGDXIYBQJ43V4RIVRANCNFSM57XH2QWQ . You are receiving this because you were mentioned.Message ID: @.***>