This commit is contained in:
Ewen 2023-09-22 08:19:18 +02:00
parent b2a03b851c
commit 488853f045
3 changed files with 26 additions and 1 deletions

View file

@ -19,7 +19,7 @@
},
validationSchema: yup.object().shape({
width: yup.number().positive().moreThan(3),
heigt: yup.number().positive().moreThan(3),
height: yup.number().positive().moreThan(3),
}),
onSubmit: (values) => {
submitPopulate(values);

View file

@ -1,4 +1,5 @@
from django.db import models
from .utils import split_word
class Level(models.Model):
@ -70,3 +71,7 @@ class Placement(models.Model):
default=Direction.RIGHT,
choices=[(Direction.RIGHT, "Right"), (Direction.BOTTOM, "Bottom")],
)
@property
def length(self):
return len(split_word(self))

20
grids/utils.py Normal file
View file

@ -0,0 +1,20 @@
import re
def split_word(word):
if word == "":
return []
else:
index_cscrabh = [match.start() for match in re.finditer("c'h", word.lower())]
print(index_cscrabh)
list_chars = []
i = 0
while i < len(word):
if i in index_cscrabh:
list_chars.append(word[i : i + 3])
i += 3
else:
list_chars.append(word[i])
i += 1
return list_chars