Beispiel #1
0
    def test_georgetown_id(self):
        # lookup should run at subsecond speed but if encoding is messed up
        # they can turn into a full table scan which taks multiple seconds
        t0 = datetime.datetime.now()
        bibid = db.get_bibid_from_summonid('b10086948')
        t1 = datetime.datetime.now()
        self.assertEqual((t1 - t0).seconds, 0)
        self.assertEqual(bibid, '4218864')

        # make sure trailing x works
        bibid = db.get_bibid_from_summonid('b1268708x')
        self.assertEqual(bibid, '4467824')
Beispiel #2
0
    def test_georgetown_id(self):
        # lookup should run at subsecond speed but if encoding is messed up
        # they can turn into a full table scan which taks multiple seconds
        t0 = datetime.datetime.now()
        bibid = db.get_bibid_from_summonid('b10086948')
        t1 = datetime.datetime.now()
        self.assertEqual((t1 - t0).seconds, 0)
        self.assertEqual(bibid, '4218864')

        # make sure trailing x works
        bibid = db.get_bibid_from_summonid('b1268708x')
        self.assertEqual(bibid, '4467824')
Beispiel #3
0
 def test_georgemason_id(self):
     # lookup should run at subsecond speed but if encoding is messed up
     # they can turn into a full table scan which taks multiple seconds
     t0 = datetime.datetime.now()
     bibid = db.get_bibid_from_summonid('m55883')
     t1 = datetime.datetime.now()
     self.assertEqual((t1 - t0).seconds, 0)
     self.assertEqual(bibid, '1560207')
Beispiel #4
0
 def test_georgemason_id(self):
     # lookup should run at subsecond speed but if encoding is messed up
     # they can turn into a full table scan which taks multiple seconds
     t0 = datetime.datetime.now()
     bibid = db.get_bibid_from_summonid('m55883')
     t1 = datetime.datetime.now()
     self.assertEqual((t1 - t0).seconds, 0)
     self.assertEqual(bibid, '1560207')
Beispiel #5
0
def related(request):
    """
    API call for getting related bibids.
    """
    bibid = request.GET.get('bibid')
    if not bibid:
        raise Http404()
    bibid = db.get_bibid_from_summonid(bibid)
    item = db.get_item(bibid)
    bibids = db.get_related_bibids(item)
    return HttpResponse(
        json.dumps(bibids, indent=2),
        content_type='application/json'
    )