Merge branch 'master' of https://gitlab.com/lilcity/backend into feature/lil-583

remotes/origin/hotfix/LIL-691
gzbender 7 years ago
commit 63a0a33cf8
  1. 2
      apps/content/templates/content/blocks/video.html
  2. 2
      apps/course/templates/course/lesson.html
  3. 22
      apps/payment/management/commands/payment_fix_amounts.py
  4. 2
      apps/payment/views.py
  5. 1
      apps/school/templates/blocks/day_pay_btn.html
  6. 2
      apps/school/templates/blocks/schedule.html
  7. 14
      apps/school/templates/blocks/schedule_item.html
  8. 2
      apps/school/templates/school/livelesson_detail.html
  9. 2
      apps/user/views.py
  10. 3
      project/templates/blocks/header.html
  11. 1
      project/templates/blocks/lil_store_js.html
  12. 18
      project/templates/blocks/promo.html
  13. 3
      project/templates/lilcity/index.html
  14. 13
      project/views.py
  15. 29
      web/src/components/ContestWorks.vue
  16. 15
      web/src/js/modules/popup.js

@ -6,7 +6,7 @@
<div class="content-block__video iframe__container">
{% if 'youtube.com' in content.url or 'youtu.be' in content.url %}
<iframe src="https://www.youtube.com/embed/{{ content.video_index }}" frameborder="0" allow="autoplay; encrypted-media"
allowfullscreen></iframe>
webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
{% elif 'vimeo.com' in content.url %}
<iframe src="https://player.vimeo.com/video/{{ content.video_index }}" frameborder="0" webkitallowfullscreen
mozallowfullscreen allowfullscreen>

@ -36,7 +36,7 @@
</div>
<div>
<div class="lesson__subtitle subtitle">{{ lesson.title }}</div>
<div class="lesson__content">{{ lesson.short_description }}</div>
<div class="lesson__content">{{ lesson.short_description | linebreaks }}</div>
<a href="{% url 'user' lesson.author.id %}">
<div class="lesson__user user">
{% if lesson.author.photo %}

@ -0,0 +1,22 @@
from decimal import Decimal
from django.core.management.base import BaseCommand
from django.db.models import F
from apps.payment.models import Payment, AuthorBalance
class Command(BaseCommand):
help = 'Fix payment and author balance amount based on payment.data.effective_price_amount'
def handle(self, *args, **options):
for payment in Payment.objects.exclude(data__effective_price_amount=''):
if payment.data.get('effective_price_amount'):
payment.amount = Decimal(payment.data.get('effective_price_amount'))
payment.save()
for ab in AuthorBalance.objects.exclude(payment__amount=F('amount')).select_related('payment'):
ab.amount = ab.payment.amount
ab.save()

@ -201,7 +201,7 @@ class PaymentwallCallbackView(View):
payment.status = pingback.get_type()
payment.data = payment_raw_data
if pingback.is_deliverable():
effective_amount = pingback.get_parameter('effective_price_amount')
effective_amount = payment_raw_data.get('effective_price_amount')
if effective_amount:
payment.amount = effective_amount

@ -1,5 +1,6 @@
<a
data-popup=".js-popup-buy"
class="timing__btn btn"
data-day="{{ school_schedule.weekday }}"
href="{% url 'school-checkout' %}?weekdays={{ school_schedule.weekday }}&add_days=true"
>купить</a>

@ -10,7 +10,7 @@
{% endfor %}
</div>
<div class="timing__foot">
<!--{% include './pay_btn.html' %}-->
{# include './pay_btn.html' #}
<a target="_blank" class="timing__print" href="{% url 'school:school_schedules-print' %}">Распечатать расписание
<span class="bold">чтобы не забыть</span>
<svg class="icon icon-print">

@ -6,12 +6,12 @@
{{ school_schedule }}
</div>
{% if is_purchased and live_lesson %}
<div class="timing__date">{{ live_lesson.date }}</div>
<div class="timing__date">{{ live_lesson.date|date:"j E" }}</div>
{% endif %}
<div class="timing__time">{{ school_schedule.start_at }} (МСК)</div>
<div class="timing__buy">
{% if is_purchased %}
{% if school_schedule.weekday in school_schedules_purchased and live_lesson and live_lesson.title %}
{% if is_purchased and school_schedule.weekday in school_schedules_purchased %}
{% if live_lesson and live_lesson.title %}
{% include './open_lesson.html' %}
{% endif %}
{% else %}
@ -32,13 +32,15 @@
<div style="display: flex; width: 100%;">
<div class="timing__cell timing__cell--preview">
<div class="timing__preview">
{% comment %}
{% thumbnail live_lesson.cover.image "70x70" crop="center" as im %}
<img class="timing__pic" src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />
{% empty %}
{% endcomment %}
<img class="timing__pic"
src="{% if school_schedule.cover %}{{ school_schedule.cover.image_thumbnail.url }}{% else %}{% static 'img/no_cover.png' %}{% endif %}"
style="width: 70px; height: 70px;" />
{% endthumbnail %}
{% comment %}{% endthumbnail %}{% endcomment %}
</div>
</div>
<div class="timing__cell timing__cell--content" {% if print %}style="flex: 1 0 0;"{% endif %}>
@ -47,11 +49,13 @@
{% endif %}
</div>
<div class="timing__content">
{% comment %}
{% if live_lesson and live_lesson.short_description %}
{{ live_lesson.short_description }}
{% else %}
{% endcomment %}
{{ school_schedule.description }}
{% endif %}
{% comment %}{% endif %}{% endcomment %}
</div>
<div class="timing__more">
<div class="timing__head">Материалы</div>

@ -7,7 +7,7 @@
<div class="section__center center center_sm">
<div class="lesson">
<div class="lesson__subtitle subtitle">{{ livelesson.title }}</div>
<div class="lesson__content">{{ livelesson.short_description }}</div>
<div class="lesson__content">{{ livelesson.short_description | linebreaks }}</div>
<div class="lesson__video video">
{% if livelesson.stream_index %}
<iframe class="lesson__video_frame" src="https://player.vimeo.com/video/{{ livelesson.stream_index }}?autoplay=1" frameborder="0" webkitallowfullscreen

@ -74,7 +74,7 @@ class ProfileView(TemplateView):
school_payment = SchoolPayment.objects.filter(
user=self.object,
date_start__lte=now(),
date_end__gt=now(),
date_end__gte=now(),
status__in=[
Pingback.PINGBACK_TYPE_REGULAR,
Pingback.PINGBACK_TYPE_GOODWILL,

@ -41,9 +41,6 @@
<div class="header__group">
<a class="header__section" href="https://blog.lil.school">БЛОГ</a>
</div>
<div class="header__group">
<a class="header__section" href="{% url 'contest' 'august' %}">КОНКУРС</a>
</div>
</nav>
</div>
{% include 'templates/blocks/user_menu.html' %}

@ -4,6 +4,7 @@
isRegistration: {{ is_registration|yesno:"true,false" }},
staticUrl: '{% static "" %}',
accessToken: '{{ request.user.auth_token }}',
isMobile: {{ request.user_agent.is_mobile|yesno:"true,false" }},
user: {
id: '{{ request.user.id|default:'' }}',
}

@ -11,22 +11,23 @@
<div class="main__title">
<span class="main__bold">Lil School</span> — первая образовательная онлайн-платформа креативного мышления для детей
</div>
{% if False and user.is_authenticated and online %}
{% if user.is_authenticated and online %}
<div class="main__content">
Сейчас идёт прямой эфир урока «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}»
</div>
<div class="main__actions">
<a
{% if not is_purchased %}
{% if not school_schedule.weekday in school_schedules_purchased %}
data-popup=".js-popup-buy"
data-day="{{ school_schedule.weekday }}"
href='#'
{% else %}
href="{{ school_schedule.current_live_lesson.get_absolute_url }}"
href="{% url 'school:school' %}"
{% endif %}
class="main__btn btn"
>{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
</div>
{% elif False and user.is_authenticated and online_coming_soon and school_schedule and school_schedule.start_at_humanize %}
{% elif user.is_authenticated and online_coming_soon and school_schedule and school_schedule.start_at_humanize %}
<div class="">
Урок «{{ school_schedule.title }}, {{ school_schedule.current_live_lesson.title }}» начнётся
</div>
@ -35,14 +36,15 @@
</div>
<div class="main__actions">
<a
{% if not is_purchased %}
{% if not school_schedule.weekday in school_schedules_purchased %}
data-popup=".js-popup-buy"
data-day="{{ school_schedule.weekday }}"
href='#'
{% else %}
href="{{ school_schedule.current_live_lesson.get_absolute_url }}"
href="{% url 'school:school' %}"
{% endif %}
class="main__btn btn"
>{% if not is_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
>{% if not school_schedule.weekday in school_schedules_purchased %}Получить доступ{% else %}Смотреть урок{% endif %}</a>
</div>
{% else %}
<div class="main__subtitle">

@ -42,6 +42,9 @@
<script type="text/javascript">
window.__lc = window.__lc || {};
window.__lc.license = 9917240;
{% if request.user.is_authenticated %}
window.__lc.visitor = { name: '{{ request.user.get_full_name }}', email: '{{ request.user.email }}' };
{% endif %}
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';

@ -1,7 +1,7 @@
from datetime import datetime, timedelta
import short_url
from django.db.models import Min
from django.db.models import Min, Func, F
from django.contrib.auth import get_user_model
from django.views.generic import TemplateView
from django.utils.timezone import now
@ -40,12 +40,10 @@ class IndexView(TemplateView):
)
online_coming_soon = (
school_schedule.start_at > now_time.time() and
(
datetime.combine(datetime.today(), school_schedule.start_at) - timedelta(hours=12)
).time() <= now_time.time() and
datetime.combine(datetime.today(), school_schedule.start_at) - timedelta(hours=12)
<= datetime.combine(datetime.today(), now_time.time()) and
school_schedule.current_live_lesson
)
date_now = now_time.date()
if self.request.user.is_authenticated:
school_payment = SchoolPayment.objects.filter(
@ -54,8 +52,9 @@ class IndexView(TemplateView):
date_end__gte=date_now
)
school_payment_exists = school_payment.exists()
school_schedules_purchased = school_payment.values_list('weekdays', flat=True)
school_schedules_purchased = school_schedules_purchased[0] if school_schedules_purchased else []
school_schedules_purchased = school_payment.annotate(
joined_weekdays=Func(F('weekdays'), function='unnest',)
).values_list('joined_weekdays', flat=True).distinct()
school_payment_future = SchoolPayment.objects.filter(
user=self.request.user,

@ -1,6 +1,6 @@
<template>
<div class="contest-works">
<div class="contest-works__works">
<div class="contest-works__works" v-if="! $root.store.isMobile">
<div class="contest-works__column">
<contest-work v-for="contestWork in columns[0]" :key="contestWork.id" :contest-work="contestWork"></contest-work>
</div>
@ -11,6 +11,9 @@
<contest-work v-for="contestWork in columns[2]" :key="contestWork.id" :contest-work="contestWork"></contest-work>
</div>
</div>
<div class="contest-works__works" v-if="$root.store.isMobile" style="display: block;">
<contest-work v-for="contestWork in contestWorks" :key="contestWork.id" :contest-work="contestWork"></contest-work>
</div>
<div v-show="loading" class="contest-works__loader"><div class="loading-loader"></div></div>
<div v-if="loaded && !contestWorks.length" class="contest-works__no-works">Здесь вы сможете увидеть работы участников после их добавления</div>
</div>
@ -48,12 +51,33 @@
},
computed: {
columns() {
const columnWidth = 300;
const heights = [0, 0, 0];
const first = [];
const second = [];
const third = [];
let index = 0;
for(let i=0; i < this.contestWorks.length; i++) {
const work = this.contestWorks[i];
[first, second, third][i % 3].push(work);
let column = index % 3;
const workHeight = work.img_height / work.img_width * columnWidth + 50;
let minHeight = 0;
if(i > 3){
for(let j=0; j < 3; j++){
let col = j % 3;
if(! minHeight || heights[j] < minHeight){
minHeight = heights[j];
if(heights[column] - heights[j] > workHeight * 0.1){
column = j;
index += j - column;
}
}
}
}
heights[column] += workHeight;
[first, second, third][column].push(work);
index++;
}
return [first, second, third];
}
@ -101,6 +125,7 @@
display: flex;
flex-direction: column;
margin-right: 20px;
width: 300px;
}
.contest-works__loader {
width: 100%;

@ -35,7 +35,8 @@ $(document).ready(function () {
popup = $('.popup.visible.open');
body.on('click', '[data-popup]', function(e){
let data = $(this).data('popup');
const $this = $(this);
let data = $this.data('popup');
if(! data) {
return true;
}
@ -51,7 +52,7 @@ $(document).ready(function () {
console.log('reset selected');
$('[data-day]').prop('checked', false);
if ($(this).text() === 'продлить') {
if ($this.text() === 'продлить') {
//data-purchased
//restore purchased selection
console.log('restore purchased');
@ -73,19 +74,19 @@ $(document).ready(function () {
}
}
if( data === '.js-popup-auth') {
let nextUrl = $(this).data('auth-next-url');
let nextUrl = $this.data('auth-next-url');
if(nextUrl === 'href') {
nextUrl = $(this).attr('href');
nextUrl = $this.attr('href');
}
popup.data('next-url', nextUrl);
}
if($(this).data('day')) {
let day = $(this).data('day');
if($this.data('day')) {
let day = $this.data('day');
$('[data-day='+day+']').prop('checked', true);
}
if(!is_extend && !$(this).data('day')) {
if(!is_extend && !$this.data('day')) {
console.log('check all');
$('[data-day]').each(function(){
$(this).prop('checked', true);

Loading…
Cancel
Save