Compute the number of works corresponding to new editions
parent
3a2cece7dd
commit
26e8024eb2
|
@ -30,8 +30,10 @@ class Command(BaseCommand):
|
||||||
continue
|
continue
|
||||||
if work.first_isbn_13():
|
if work.first_isbn_13():
|
||||||
new_editions = bookloader.add_related( work.first_isbn_13() )
|
new_editions = bookloader.add_related( work.first_isbn_13() )
|
||||||
|
corresponding_works = set([ed.work for ed in new_editions])
|
||||||
print "clustered %s editions for work %s" % (len(new_editions),work ), \
|
print "clustered %s editions for work %s" % (len(new_editions),work ), \
|
||||||
"| Corresponding works : ", [(w.id, w.language, w.editions.count()) for w in set([ed.work for ed in new_editions])]
|
"| Corresponding works : ", [(w.id, w.language, w.editions.count()) for w in corresponding_works], \
|
||||||
|
"#corresponding_works:%s" % (len(corresponding_works))
|
||||||
else:
|
else:
|
||||||
print "no ISBN for this work and therefore no new editions"
|
print "no ISBN for this work and therefore no new editions"
|
||||||
print "Updated Number of singleton Works with language = %s: %s" % (language,models.Work.objects.annotate(num_editions=Count('editions')).filter(num_editions=1, language=language).count() )
|
print "Updated Number of singleton Works with language = %s: %s" % (language,models.Work.objects.annotate(num_editions=Count('editions')).filter(num_editions=1, language=language).count() )
|
||||||
|
|
Loading…
Reference in New Issue