Merge branch 'hotfix/send-camp-cert-9-07-19' into 'master'

не отправились грамоты за рисовальный лагерь

See merge request lilschool/site!342
remotes/origin/feature/free-lessons
Danil 7 years ago
commit 8c89936fc0
  1. 10
      apps/notification/tasks.py
  2. 2
      project/settings.py
  3. 0
      resources/camp-certificates/1.jpg
  4. 0
      resources/camp-certificates/2.jpg
  5. 0
      resources/camp-certificates/3.jpg
  6. 0
      resources/signed-camp-certificates/1.jpg
  7. 0
      resources/signed-camp-certificates/2.jpg
  8. 0
      resources/signed-camp-certificates/3.jpg
  9. 1
      web/src/sass/_common.sass
  10. 15
      web/webpack.config.js

@ -179,8 +179,8 @@ def send_child_birthday_email_and_bonuses():
@app.task @app.task
def send_camp_certificates(email=None, dry_run=False, certificate_number=None): def send_camp_certificates(email=None, dry_run=False, certificate_number=None):
path_pattern = 'img/camp-certificates/%d.jpg' path_pattern = 'camp-certificates/%d.jpg'
signed_path_pattern = 'img/signed-camp-certificates/%d.jpg' signed_path_pattern = 'signed-camp-certificates/%d.jpg'
color = (0, 27, 94) color = (0, 27, 94)
if certificate_number is None: if certificate_number is None:
certificate_number = 1 certificate_number = 1
@ -189,7 +189,7 @@ def send_camp_certificates(email=None, dry_run=False, certificate_number=None):
if certificate_number == 3: if certificate_number == 3:
color = (24, 57, 220) color = (24, 57, 220)
if email: if email:
fn = draw_cert(staticfiles_storage.path(signed_path_pattern % certificate_number), email, 'Имя', 'Фамилия', fn = draw_cert(os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % certificate_number), email, 'Имя', 'Фамилия',
font_size=120, y=1000, color=color) font_size=120, y=1000, color=color)
file = open(fn, 'rb') file = open(fn, 'rb')
try: try:
@ -221,12 +221,12 @@ def send_camp_certificates(email=None, dry_run=False, certificate_number=None):
file_names = [] file_names = []
if un.user.child_filled: if un.user.child_filled:
fn = staticfiles_storage.path(signed_path_pattern % certificate_number) fn = os.path.join(settings.RESOURCES_ROOT, signed_path_pattern % certificate_number)
for child in un.user.childs.all(): for child in un.user.childs.all():
file_names.append(draw_cert(fn, un.user.email, child.first_name, child.last_name, file_names.append(draw_cert(fn, un.user.email, child.first_name, child.last_name,
font_size=120, y=1000, color=color)) font_size=120, y=1000, color=color))
else: else:
file_names.append(staticfiles_storage.path(path_pattern % certificate_number)) file_names.append(os.path.join(settings.RESOURCES_ROOT, path_pattern % certificate_number))
files = [open(fn, 'rb') for fn in file_names] files = [open(fn, 'rb') for fn in file_names]
try: try:
send_email('Грамота от Lil School', un.user.email, 'notification/email/camp_certificate.html', send_email('Грамота от Lil School', un.user.email, 'notification/email/camp_certificate.html',

@ -182,6 +182,8 @@ STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesSto
MEDIA_URL = '/media/' MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
RESOURCES_ROOT = os.path.join(BASE_DIR, 'resources')
LOGIN_URL = '/' LOGIN_URL = '/'
# Email # Email
# https://github.com/anymail/django-anymail # https://github.com/anymail/django-anymail

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

@ -2975,6 +2975,7 @@ a.grey-link
fill: #000000 fill: #000000
&__toggle &__toggle
margin-top: 10px margin-top: 10px
margin-left: 10px
display: inline-block display: inline-block
&--heart &--heart
&__content &__content

@ -20,9 +20,7 @@ module.exports = {
sprite: glob('./src/icons/*.svg'), sprite: glob('./src/icons/*.svg'),
images: glob('./src/img/*.*'), images: glob('./src/img/*.*'),
imagesCertificates: glob('./src/img/user-certificates/*'), imagesCertificates: glob('./src/img/user-certificates/*'),
imagesSignedCertificates: glob('./src/img/signed-user-certificates/*'),
imagesGiftCertificates: glob('./src/img/gift-certificates/*'), imagesGiftCertificates: glob('./src/img/gift-certificates/*'),
imagesCampCertificates: glob('./src/img/camp-certificates/*'),
imagesReviews: glob('./src/img/reviews/*'), imagesReviews: glob('./src/img/reviews/*'),
fonts: glob('./src/fonts/*'), fonts: glob('./src/fonts/*'),
sounds: glob('./src/sounds/*'), sounds: glob('./src/sounds/*'),
@ -96,8 +94,7 @@ module.exports = {
test: /\.(png|gif|jpg|svg)$/, test: /\.(png|gif|jpg|svg)$/,
exclude: [path.resolve(__dirname, 'src/icons'), path.resolve(__dirname, 'src/img/user-certificates'), exclude: [path.resolve(__dirname, 'src/icons'), path.resolve(__dirname, 'src/img/user-certificates'),
path.resolve(__dirname, 'src/img/gift-certificates'), path.resolve(__dirname, 'src/img/reviews'), path.resolve(__dirname, 'src/img/gift-certificates'), path.resolve(__dirname, 'src/img/reviews'),
path.resolve(__dirname, 'src/img/signed-user-certificates'), path.resolve(__dirname, 'src/img/camp-certificates'), path.resolve(__dirname, 'src/img/signed-user-certificates')],
path.resolve(__dirname, 'src/img/signed-camp-certificates')],
loader: 'file-loader?name=[name].[ext]&outputPath=./img/' loader: 'file-loader?name=[name].[ext]&outputPath=./img/'
}, },
{ {
@ -115,16 +112,6 @@ module.exports = {
include: path.resolve(__dirname, 'src/img/gift-certificates'), include: path.resolve(__dirname, 'src/img/gift-certificates'),
loader: 'file-loader?name=[name].[ext]&outputPath=./img/gift-certificates/' loader: 'file-loader?name=[name].[ext]&outputPath=./img/gift-certificates/'
}, },
{
test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/camp-certificates'),
loader: 'file-loader?name=[name].[ext]&outputPath=./img/camp-certificates/'
},
{
test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/signed-camp-certificates'),
loader: 'file-loader?name=[name].[ext]&outputPath=./img/signed-camp-certificates/'
},
{ {
test: /\.(png|jpg)$/, test: /\.(png|jpg)$/,
include: path.resolve(__dirname, 'src/img/reviews'), include: path.resolve(__dirname, 'src/img/reviews'),

Loading…
Cancel
Save