edtechhub / zotero-edtechhub

https://github.com/edtechhub/zotero-edtechhub/projects/4
12 stars 3 forks source link

Latest version: ";" instead of " " doesn't update extra #72

Closed bjohas closed 4 years ago

bjohas commented 4 years ago

This line (220) in the source has:

  changed() {
    return this.size !== this.aka.size
  }

Does this compare the string length? If yes, then changing ";" to " " doesn't trigger an update. Could you give add the code that actually compares the old/new values as string?

  changed() {
    return STRING(init or this) !== STRING(this.aka)
  }

I didn't know how to do it as I'm not sure of the types.

Background: In the code, I have changed this line

    this.aka = new Set(init.split(init.includes(';') ? /; */ : / +/).filter(aka => aka))

The intention is to change ";" or "; " to " ". Once I've upgraded all the libraries, we'll change this to:

    this.aka = new Set(init.split(/ +/).filter(aka => aka))

I suppose the above line could be written like this to cater for both cases:

    this.aka = new Set(init.split(/(;| ) */).filter(aka => aka))
bjohas commented 4 years ago

I think this was a false alarm.

retorquere commented 4 years ago

Does this compare the string length? If yes, then changing ";" to " " doesn't trigger an update. Could you give add the code that actually compares the old/new values as string?

It compares the number of IDs in the set. I agree it's better to use the string to compare, so that'd become

constructor(init: string = '') {
    // Changing syntax for separator in aka from ";" or "; " to " " (/ +/ to be precise). Only allow / +/ in future release.
    this.aka = new Set(init.split(init.includes(';') ? /; */ : / +/).filter(aka => aka))
    this.init = this.toString()
  }

  add(id: string) {
    id = (id || '').trim()
    if (id) this.aka.add(id)
    return this
  }

  changed() {
    return this.init !== this.toString()
  }
bjohas commented 4 years ago

Thank you - I'll look at that!  There seems to be another issue, where e.g.

AKA: B;C;A

now becomes 

AKA: B A B C

I.e. the list is sorted, but the original item is stuck at the front. I could be wrong... will check again tomorrow.

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.269 ("string to compare fixes #72")

Install in Zotero by downloading test build 0.0.30.269, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.271 ("whitespace")

Install in Zotero by downloading test build 0.0.30.271, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.272 ("adding debug fixes #72")

Install in Zotero by downloading test build 0.0.30.272, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.273 ("debug cases fixes #72")

Install in Zotero by downloading test build 0.0.30.273, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.274 ("debugging ...")

Install in Zotero by downloading test build 0.0.30.274, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.275 ("item catch added")

Install in Zotero by downloading test build 0.0.30.275, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.276 ("beta fixed")

Install in Zotero by downloading test build 0.0.30.276, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.277 ("prefix updated")

Install in Zotero by downloading test build 0.0.30.277, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.278 ("Merge branch 'gh-72' of github.com:edtechhub/zotero-edtechhub into gh-72")

Install in Zotero by downloading test build 0.0.30.278, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

edtechbot commented 4 years ago

:robot: this is your friendly neighborhood build bot announcing test build 0.0.30.279 ("debugger removed")

Install in Zotero by downloading test build 0.0.30.279, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".