Align copy option with changes to multipart
authorArt Rhyno <art632000@yahoo.ca>
Tue, 15 Apr 2014 12:47:22 +0000 (08:47 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Tue, 15 Apr 2014 12:47:22 +0000 (08:47 -0400)
This puts the copy option in sync with the changes
to Item for multipart. Also fix up evergreen integration
level to render item statuses consistently for multipart.

Signed-off-by: Art Rhyno <art632000@yahoo.ca>
conifer/integration/evergreen_site.py
conifer/syrup/views/sites.py

index 8f32713..1800282 100644 (file)
@@ -191,7 +191,10 @@ class EvergreenIntegration(object):
     see: http://code.activestate.com/recipes/325905/
     """
 
-    CACHE_TIME = 300
+    #CACHE_TIME = 300
+
+    #set low for testing
+    CACHE_TIME = 5
 
     @memoize(timeout=CACHE_TIME)
     def _item_status(self, bib_id, barcode, bclist, idlist):
@@ -488,11 +491,7 @@ class EvergreenIntegration(object):
                                 if len(allcalls) == 0 and dueid[1] != LOCKED and copy.syrup_id != -1:
                                     dueid = [copy.syrup_id,DUE]
 
-                            if copy.part_label:
-                                alldisplay = '%s - %s (DUE: %s)' % (callno,
-                                    copy.part_label,time.strftime(self.DUE_FORMAT,earliestdue))
-                            else:
-                                alldisplay = '%s (DUE: %s)' % (callno,time.strftime(self.DUE_FORMAT,earliestdue))
+                            alldisplay = '%s (DUE: %s)' % (callno,time.strftime(self.DUE_FORMAT,earliestdue))
 
                             if len(allcalls) > 0:
                                 if allcalls[len(allcalls) - 1][1] != LOCKED:
@@ -502,6 +501,10 @@ class EvergreenIntegration(object):
                             elif avail >= 1:
                                 avail -= 1
                                
+                            if copy.part_label and copy.part_label not in alldisplay:
+                                alldisplay = '%s %s (DUE: %s)' % (callno,
+                                    copy.part_label,time.strftime(self.DUE_FORMAT,earliestdue))
+
                         elif len(allcalls) > 0:
                             allcalls[len(allcalls) - 1] = [callno,LOCKED,copy.syrup_id,copy.part_label]
 
index 83cc5a8..8dd3878 100644 (file)
@@ -245,6 +245,7 @@ def duplicate_sites(request,sel_sites,new_start_term,new_end_term):
                end_term = new_end_term,
                owner = sel_site.owner,
                service_desk = sel_site.service_desk)
+
             _copy_contents(request, sel_site, course_site)
             duplicated.append(course_site.pk)
     return duplicated
@@ -410,7 +411,7 @@ def site_clipboard_copy_from(request, site_id):
 def _copy_contents(request, source_site, dest_site):
     item_map = {}
 
-    def process_item(parent, (item, subitems)):
+    def process_item(parent, (item, subitems,extra1,extra2)):
         dct = dict((k,v) for k,v in item.__dict__.items() if not k.startswith('_'))
         old_id = dct['id']
         del dct['id']