Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Aug 15, 2019
2 parents afde5cc + 956b857 commit df24b99
Show file tree
Hide file tree
Showing 117 changed files with 956 additions and 2,755 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 1.1.0


- Add user dashboard listing daily questions.
- Add 9 new questions.
- Redesign homepage.
- Add privacy policy, terms of service, and cookie policy.
- Fix reCAPTCHA checkers.
- Fix bug where users could register for a research study with no groups.
- Provide link to dashboard after questions.
- Simplify available navbar items.

## 1.0.0

Initial release of codeWOF website, containing the following key features:
Expand Down
2 changes: 1 addition & 1 deletion codewof/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Configuration for Django system."""

__version__ = "1.0.0"
__version__ = "1.1.0"
__version_info__ = tuple(
[
int(num) if num.isdigit() else num
Expand Down
2 changes: 1 addition & 1 deletion codewof/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@

# Other
# ------------------------------------------------------------------------------
DEPLOYMENT_TYPE = 'local'
DEPLOYMENT_TYPE = env("DEPLOYMENT", default='local')
QUESTIONS_BASE_PATH = os.path.join(str(ROOT_DIR.path("programming")), "content")
CUSTOM_VERTO_TEMPLATES = os.path.join(str(ROOT_DIR.path("utils")), "custom_converter_templates", "")
SAMPLE_DATA_ADMIN_PASSWORD = env('SAMPLE_DATA_ADMIN_PASSWORD', default='password')
Expand Down
1 change: 1 addition & 0 deletions codewof/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
GS_BUCKET_NAME = env('GOOGLE_CLOUD_STORAGE_BUCKET_MEDIA_NAME')
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(env('GOOGLE_APPLICATION_CREDENTIALS')) # noqa: F405,E501
GS_FILE_OVERWRITE = False
GS_DEFAULT_ACL = 'publicRead'

STATIC_URL = 'https://storage.googleapis.com/' + env('GOOGLE_CLOUD_STORAGE_BUCKET_STATIC_NAME') + '/static/' # noqa: F405,E501

Expand Down
2 changes: 2 additions & 0 deletions codewof/general/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.core.mail import send_mail, mail_managers
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from captcha.fields import ReCaptchaField

SUBJECT_TEMPLATE = "[CodeWOF] - {}"
MESSAGE_TEMPLATE = "{}\n\n-----\nMessage sent from {}\n-----\ncodeWOF"
Expand All @@ -18,6 +19,7 @@ class ContactForm(forms.Form):
subject = forms.CharField(required=True)
message = forms.CharField(widget=forms.Textarea, required=True)
cc_sender = forms.BooleanField(required=False, label='Send a copy to yourself')
captcha = ReCaptchaField()

def send_email(self):
"""Send email if form is valid."""
Expand Down
2,548 changes: 0 additions & 2,548 deletions codewof/general/management/commands/sample-data/nz-schools.csv

This file was deleted.

3 changes: 2 additions & 1 deletion codewof/general/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
app_name = 'general'
urlpatterns = [
path('', views.HomeView.as_view(), name='home'),
path('about/', views.AboutView.as_view(), name='about'),
# path('about/', views.AboutView.as_view(), name='about'),
path('policies/', views.PolicyView.as_view(), name='policies'),
path('contact-us/', views.ContactView.as_view(), name='contact'),
path('contact-us/success/', views.ContactSuccessView.as_view(), name='contact-success'),
path('faq/', views.FAQView.as_view(), name='faq'),
Expand Down
6 changes: 6 additions & 0 deletions codewof/general/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ class AboutView(TemplateView):
template_name = 'general/about.html'


class PolicyView(TemplateView):
"""View for website policies page."""

template_name = 'general/policies.html'


class ContactView(FormView):
"""View for website contact page."""

Expand Down
12 changes: 12 additions & 0 deletions codewof/programming/content/en/divisible-by-3/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Divisible by 3

Write a function `divisible_by_three(x)` that takes a Python list of numbers, `x`, and prints out the
numbers in the list that are divisble by 3.

For example if we call `divisible_by_three([6,97,43,27,99])` the output should be:

```
6
27
99
```
4 changes: 4 additions & 0 deletions codewof/programming/content/en/divisible-by-3/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def divisible_by_three(x):
for num in x:
if num % 3 == 0:
print(num)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
divisible_by_three([6,97,43,27,99])
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
6
27
99
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
divisible_by_three([1,4,98])
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
divisible_by_three([-3,105,-936, 65, 33, 90])
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-3
105
-936
33
90
2 changes: 1 addition & 1 deletion codewof/programming/content/en/double-evens/question.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Double evens
# Double Evens

Write a function `double_even(number)` that takes a number and returns double the number if it is even.
Otherwise it returns the original number.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def smallest_number(numbers):
smallest = numbers[0]
for num in numbers:
if num < smallest:
smallest = num
return smallest
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Find Smallest Number

The following function `smallest_number(numbers)` takes a list `numbers` as an argument and should return the smallest
number in the list.

This function looks like it should work, but there are problems with it. Find the bug (or bugs) to fix the function.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def smallest_number(numbers):
smallest = numbers[0]
for num in numbers:
if num < smallest:
smallest = num
return smallest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(smallest_number([3, 5, 6, 7, 4, 2]))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(smallest_number([4, 5, 8, 3, 2, 1]))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(smallest_number([-1, 2, 3, 4, 5]))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(smallest_number([10, 4, 18, 5, 187]))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(smallest_number([-10, -20, -30, -18, -4]))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-30
7 changes: 7 additions & 0 deletions codewof/programming/content/en/good-password/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Good Password

Write a program that asks the user for a password in order to check if it meets the requirements for a password. For
the purposes of this question, a password is good enough if it is at least 5 characters long.

If the password meets the requirements then print `Thank you, your password is good enough`, otherwise print
`No, this password is not good enough`. Keep asking the user for a password until they enter one that meets the requirements.
5 changes: 5 additions & 0 deletions codewof/programming/content/en/good-password/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
password = input("What is the password? ")
while len(password) < 5:
print("No, this password is not good enough")
password = input("What is the password? ")
print("Thank you, your password is good enough")
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
add
fall
join
name
off
on
after
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
Thank you, your password is good enough
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
holiday
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thank you, your password is good enough
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
job
minute
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
No, this password is not good enough
Thank you, your password is good enough
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
map
open
page
put
whiteboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
Thank you, your password is good enough
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
neck
knee
head
structure
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
No, this password is not good enough
No, this password is not good enough
No, this password is not good enough
Thank you, your password is good enough
2 changes: 1 addition & 1 deletion codewof/programming/content/en/over-the-limit/question.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Over the limit?
#Over the Limit?

Write a function `over_alcohol_limit(mcg_per_litre)` that is part of a
breath testing machine. The function should return `True` if a value of
Expand Down
8 changes: 8 additions & 0 deletions codewof/programming/content/en/reverse-string/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Reverse String

Write a function `reverse_string(string)` that takes the string, `string`, and prints the string in reverse.

For example, if we call `reverse_string('Mountain')` the output should be:
niatnuoM

*Hint: the* `range` *function could be useful*
5 changes: 5 additions & 0 deletions codewof/programming/content/en/reverse-string/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def reverse_string(string):
reverse = ''
for char in range(len(string) - 1, -1, -1):
reverse += string[char]
print(reverse)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reverse_string('Mountain')
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
niatnuoM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reverse_string('I love Python')
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nohtyP evol I
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reverse_string('')
Empty file.
14 changes: 14 additions & 0 deletions codewof/programming/content/en/rotate-words/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#Rotate Words

Write a program that asks the user for some words and prints out the words vertically rather
than horizontally. If the user inputs the string `Example` then your program should print:

```
E
x
a
m
p
l
e
```
3 changes: 3 additions & 0 deletions codewof/programming/content/en/rotate-words/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
words = input("Words please: ")
for char in words:
print(char)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
E
x
a
m
p
l
e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello-World!
12 changes: 12 additions & 0 deletions codewof/programming/content/en/rotate-words/test-case-2-output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
H
e
l
l
o
-
W
o
r
l
d
!
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Testing-testing...
18 changes: 18 additions & 0 deletions codewof/programming/content/en/rotate-words/test-case-4-output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
T
e
s
t
i
n
g
-
t
e
s
t
i
n
g
.
.
.
2 changes: 1 addition & 1 deletion codewof/programming/content/en/say-hello/question.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Say hello!
# Say Hello!

Write a program that prints `Hello world!`.
9 changes: 9 additions & 0 deletions codewof/programming/content/en/shopping-list/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#Shopping List

Write a function `print_shopping_list(shopping_list)` that takes a list `shopping_list` and prints each item on a new
line with a checkbox `[]` made of square brackets in front of it. For example, calling
`print_shopping_list(['Spinach', 'Chickpeas'])` should print:
```
[] Spinach
[] Chickpeas
```
3 changes: 3 additions & 0 deletions codewof/programming/content/en/shopping-list/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def print_shopping_list(shopping_list):
for item in shopping_list:
print("[] " + item)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print_shopping_list(['Apples', 'Bananas', 'Taro'])
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[] Apples
[] Bananas
[] Taro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print_shopping_list(['Oranges', 'Cereal', 'Broccoli', 'Gold Kumara'])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[] Oranges
[] Cereal
[] Broccoli
[] Gold Kumara
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print_shopping_list(['Bread', 'Mushrooms'])
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[] Bread
[] Mushrooms
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print_shopping_list(['Onions', 'Garlic', 'Capsicum', 'Pineapple'])
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[] Onions
[] Garlic
[] Capsicum
[] Pineapple
14 changes: 14 additions & 0 deletions codewof/programming/content/en/triangle-pattern/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Triangle Pattern

Write a function `triangle(x)` that takes an integer `x` and prints out a triangle (made up of `*` symbols) of depth `x`.
For example if we call `triangle(5)` we would expect the output to be:

```
*
**
***
****
*****
```

If `x` is less than 1 (inlcusive), your function should print `That isn't a triangle!`
6 changes: 6 additions & 0 deletions codewof/programming/content/en/triangle-pattern/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def triangle(x):
if x <= 1:
print("That isn't a triangle!")
else:
for i in range(1, x+1):
print(i * '*')
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
triangle(5)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
**
***
****
*****
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
triangle(1)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
That isn't a triangle!
Loading

0 comments on commit df24b99

Please sign in to comment.