Skip to content

Session Release Date #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
DEBUG=True
ENABLE_DEV_FIXTURES=True


SITE_NAME=We All Code
SITE_URL=http://localhost:8000
SECRET_KEY=CHANGEME
DJANGO_SECURE_SSL_REDIRECT=False


# Database
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mysecretpassword


# Email
[email protected]
[email protected]
SENDGRID_API_KEY=CHANGEME
SENDGRID_UNSUB_CLASSANNOUNCE=1234567890


# AWS
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=


# Sentry
SENTRY_DSN=


# reCAPTCHA
RECAPTCHA_PUBLIC_KEY=
RECAPTCHA_PRIVATE_KEY=
Expand Down
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,32 @@
"editor.quickSuggestions": false,
"editor.trimAutoWhitespace": false,
},
"cSpell.words": [
"authed",
"Boto",
"coderodojochi",
"dateutil",
"dtend",
"favicon",
"favicons",
"gunicorn",
"Hmmss",
"iaarj",
"icalendar",
"loginas",
"mstile",
"noqa",
"pjpeg",
"PROTO",
"pytz",
"REFERER",
"Signup",
"strftime",
"strptime",
"strptime",
"strtobool",
"strtobool",
"unauthed",
"YYYYMMDDTH",
],
}
2 changes: 1 addition & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions coderdojochi/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
list_display = [
'_course',
'start_date',
# 'end_date',
'location',
'capacity',
'student_count_link',
Expand Down Expand Up @@ -568,9 +567,7 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'course',
'location',
'start_date',
# 'old_end_date',
# 'old_mentor_start_date',
# 'old_mentor_end_date',
'release_date',
'capacity',
'mentor_capacity',
'instructor',
Expand Down Expand Up @@ -602,6 +599,9 @@ class SessionAdmin(ImportExportMixin, ImportExportActionModelAdmin):
'announced_date_guardians',
'mentors_week_reminder_sent',
'mentors_day_reminder_sent',
# 'old_end_date',
# 'old_mentor_start_date',
# 'old_mentor_end_date',
),
}),
)
Expand Down
19 changes: 0 additions & 19 deletions coderdojochi/migrations/0029_course_duration.py

This file was deleted.

28 changes: 0 additions & 28 deletions coderdojochi/migrations/0030_auto_20200101_2217.py

This file was deleted.

50 changes: 50 additions & 0 deletions coderdojochi/migrations/0030_session_release_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 2.2.9 on 2020-01-05 23:20

import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

def set_release_date_if_null(apps, schema_editor):
Session = apps.get_model('coderdojochi', 'Session')

for session in Session.objects.filter().iterator():
# If the start_date is in the past, set release_date to the start_date
if session.start_date <= timezone.now() and session.announced_date_guardians:
session.release_date = session.announced_date_guardians
else:
# Subtract 1 week
session.release_date = session.start_date - timedelta(weeks=1)

# If it's not on a monday, go to the previous monday
session.release_date -= timedelta(days=session.release_date.weekday())

# Set it to 9am of that day
session.release_date = session.release_date.replace(hour=9)

session.save()


def reverse_set_release_date_if_null(apps, schema_editor):
pass # code for reverting migration, if any


dependencies = [
('coderdojochi', '0029_course_duration_squashed_0040_auto_20200102_1801'),
]

operations = [
migrations.AddField(
model_name='session',
name='release_date',
field=models.DateTimeField(null=True, blank=True, help_text="The date guardians can sign up. If not set, the system will pick 1 week (Monday) from 'Start Date'."),
preserve_default=False,
),
migrations.RunPython(set_release_date_if_null, reverse_set_release_date_if_null),
migrations.AlterField(
model_name='session',
name='release_date',
field=models.DateTimeField(blank=True, help_text="The date guardians can sign up. If not set, the system will pick 1 week (Monday) from 'Start Date'."),
),
]
28 changes: 0 additions & 28 deletions coderdojochi/migrations/0031_auto_20200101_2218.py

This file was deleted.

23 changes: 0 additions & 23 deletions coderdojochi/migrations/0032_auto_20200101_2221.py

This file was deleted.

24 changes: 0 additions & 24 deletions coderdojochi/migrations/0033_auto_20200101_2222.py

This file was deleted.

24 changes: 0 additions & 24 deletions coderdojochi/migrations/0034_auto_20200101_2225.py

This file was deleted.

24 changes: 0 additions & 24 deletions coderdojochi/migrations/0035_auto_20200101_2230.py

This file was deleted.

18 changes: 0 additions & 18 deletions coderdojochi/migrations/0036_auto_20200101_2238.py

This file was deleted.

18 changes: 0 additions & 18 deletions coderdojochi/migrations/0037_auto_20200101_2239.py

This file was deleted.

Loading