From 95ba5d5408362b9999a885a034c576f801a3a26e Mon Sep 17 00:00:00 2001 From: Art Rhyno Date: Tue, 15 Apr 2014 08:47:22 -0400 Subject: [PATCH] Align copy option with changes to multipart 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 --- conifer/integration/evergreen_site.py | 15 +++++++++------ conifer/syrup/views/sites.py | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/conifer/integration/evergreen_site.py b/conifer/integration/evergreen_site.py index 8f32713..1800282 100644 --- a/conifer/integration/evergreen_site.py +++ b/conifer/integration/evergreen_site.py @@ -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] diff --git a/conifer/syrup/views/sites.py b/conifer/syrup/views/sites.py index 83cc5a8..8dd3878 100644 --- a/conifer/syrup/views/sites.py +++ b/conifer/syrup/views/sites.py @@ -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'] -- 2.11.0