Marquise cover and some fixes.
authorRadek Czajka <rczajka@rczajka.pl>
Fri, 6 May 2022 12:32:04 +0000 (14:32 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Fri, 6 May 2022 12:32:04 +0000 (14:32 +0200)
requirements/requirements.txt
src/catalogue/fields.py
src/catalogue/templates/catalogue/2022/book_detail.html
src/experiments/base.py
src/wolnelektury/templates/piwik/tracking_code.html

index 5b43762..97fc791 100644 (file)
@@ -1,7 +1,7 @@
 -i https://py.mdrn.pl/simple/
 
 # django
-Django==2.2.27
+Django==2.2.28
 fnpdjango==0.4.5
 docutils==0.16
 
@@ -44,7 +44,7 @@ mutagen==1.45.1
 sorl-thumbnail==12.7.0
 
 # home-brewed & dependencies
-librarian==2.3.5
+librarian==2.4
 
 # celery tasks
 celery[redis]==4.4.7
index 49fd46e..faff5c6 100644 (file)
@@ -347,8 +347,11 @@ class BuildCover(BuildEbook):
 class BuildCoverClean(BuildCover):
     @classmethod
     def transform(cls, wldoc, fieldfile):
-        from librarian.cover import WLCover
-        return WLCover(wldoc.book_info, width=240).output_file()
+        if wldoc.book_info.cover_box_position == 'none':
+            from librarian.cover import WLCover
+            return WLCover(wldoc.book_info, width=240).output_file()
+        from librarian.covers.marquise import MarquiseCover
+        return MarquiseCover(wldoc.book_info, width=240).output_file()
 
 
 @BuildEbook.register('cover_thumb')
index 9dfac94..e0c82e0 100644 (file)
           <div class="c-support">
             <div>
               <h2>Ta książka jest dostępna dla tysięcy dzieciaków dzięki <span>darowiznom</span> od osób takich jak <span>Ty</span>!</h2>
-              <a href="{% url 'club_join' %}">Dorzuć się!</a>
+              <a href="{% url 'club_join' %}?pk_campaign=layout">Dorzuć się!</a>
             </div>
             <figure>
               <img src="{% static '2022/images/dziecko.jpeg' %}" alt="Dorzuć się!">
index 3430df2..726f451 100644 (file)
@@ -12,26 +12,27 @@ class Experiment:
         return True
 
     def __init__(self, request):
-        self.value = self.get_value(request)
+        self.value, self.manual = self.get_value(request)
 
     def override(self, value):
         self.value = value
+        self.manual = False
         
     def get_value(self, request):
         overrides = getattr(settings, 'EXPERIMENTS_OVERRIDES', {})
         slug = self.slug
         if slug in overrides:
-            return overrides[slug]
+            return overrides[slug], False
 
         if self.qualify(request) is False:
-            return None
+            return None, False
 
         cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}')
         if cookie_value is not None:
             if cookie_value == 'on':
-                return True
+                return True, True
             elif cookie_value == 'off':
-                return False
+                return False, True
 
         number = int(
             hashlib.md5(
@@ -39,4 +40,4 @@ class Experiment:
             ).hexdigest(),
             16
         ) % 10e6 / 10e6
-        return number < self.size
+        return number < self.size, False
index b70225e..2dd3f11 100644 (file)
@@ -2,7 +2,7 @@
 <script type="text/javascript">
   var _paq = window._paq || [];
   {% for slug, experiment in request.EXPERIMENTS.items %}
-    _paq.push(['setCustomVariable', '{{ forloop.counter }}', "{{ slug }}", "{{ experiment.value|yesno:"on,off," }}", "visit"]);
+    _paq.push(['setCustomVariable', '{{ forloop.counter }}', "{{ slug }}", "{{ experiment.value|yesno:"on,off," }}{{ experiment.manual|yesno:"-manual,," }}", "visit"]);
   {% endfor %}
   _paq.push(['trackPageView']);
   _paq.push(['enableLinkTracking']);