cytoscape / appstore

Cytoscape App Store web application code
16 stars 20 forks source link

Pin "collections" tag to top of Categories #27

Closed AlexanderPico closed 8 years ago

AlexanderPico commented 8 years ago

We should override the dynamic sorting of category tags and pin "collections" to the top.

AdamStuart commented 8 years ago

apps/views.py: 43

try:
    tag = get_object_or_404(Tag, name = 'systems biology')
    if tag:
        idx = sorted_tags.index(tag)
        if idx >= 0:
           sorted_tags.pop(idx)
           sorted_tags.insert(0, tag)
except Http404:
    idx = 0 
AlexanderPico commented 8 years ago

Cool. It looks like you've got this working (for the 'scripting' tag) on apps-dev. Can you do this on apps-test for 'collections'?

We are switching over on Monday and it'd be great to have this in place.

AlexanderPico commented 8 years ago

Tried the code above and the code found at apps-dev:

try:
    tag = get_object_or_404(Tag, name = 'collections')
        idx = sorted_tags.index(tag)
           sorted_tags.pop(idx)
           sorted_tags.insert(0, tag)
except Http404:
    idx = 0

Neither seems to bump "collections" up to the top.

AlexanderPico commented 8 years ago

Right. That copy/paste was messy :) I tried matching the tab/sp indentation currently at apps-dev as precisely as I could...

Any other code changes that might be relevant?

AlexanderPico commented 8 years ago

Probably easiest if you ask Barry to add your IP address to the whitelist so you can reproduce the fix. Or check the fix into repo and I'll pull it.

AlexanderPico commented 8 years ago

Ok. Got it! Added your code, which worked fine for "scripting", but even on apps-test where there is a tag for "collections" that was leading to a 500 error. This error traced back to a ZeroDivisionError just a few lines below your code, so I added a try/except and it now appears to be working and solid.