uchicago-library / mlc_ucla

GNU General Public License v3.0
0 stars 0 forks source link

Final frontend updates before launch. #43

Closed vitorgomateus closed 7 months ago

vitorgomateus commented 7 months ago
johnjung commented 7 months ago

This looks pretty good so far. I tested some timings with the following three items- these are some sample items with lots of descendant formats:

item/b2051c02741f (5 descendants) item/b20h8hc2sf44 (6 desscendants) item/b20q4gb3zp83 (27 descendants)

The last one returned in about 1.25 seconds on my dev machine- this seems fast enough to me.

In mlc_ucla_search.py, I would change the sortDictByFormat() function a bit. RIght now, it starts with:

if( type(item) != str):
    item = item[0]

I would be explicit and check what the item is:

if isinstance(item, tuple):
    item = item[0]

Or even better, I'd use some assertions to make the function catch more errors, like this:

assert type(item) in (str, tuple)
if isinstance(item, tuple):
    assert len(item)
    assert isinstance(item[0], str)
    item = item[0]

Otherwise the changes look pretty good. Please let me know what you think- if you like those changes please add them in a new commit and I'll merge everything right away.

vitorgomateus commented 7 months ago

Your code looks better. I committed it along with a typo fix.