wip
This commit is contained in:
parent
b2a03b851c
commit
488853f045
|
@ -19,7 +19,7 @@
|
||||||
},
|
},
|
||||||
validationSchema: yup.object().shape({
|
validationSchema: yup.object().shape({
|
||||||
width: yup.number().positive().moreThan(3),
|
width: yup.number().positive().moreThan(3),
|
||||||
heigt: yup.number().positive().moreThan(3),
|
height: yup.number().positive().moreThan(3),
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
submitPopulate(values);
|
submitPopulate(values);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from .utils import split_word
|
||||||
|
|
||||||
|
|
||||||
class Level(models.Model):
|
class Level(models.Model):
|
||||||
|
@ -70,3 +71,7 @@ class Placement(models.Model):
|
||||||
default=Direction.RIGHT,
|
default=Direction.RIGHT,
|
||||||
choices=[(Direction.RIGHT, "Right"), (Direction.BOTTOM, "Bottom")],
|
choices=[(Direction.RIGHT, "Right"), (Direction.BOTTOM, "Bottom")],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def length(self):
|
||||||
|
return len(split_word(self))
|
||||||
|
|
20
grids/utils.py
Normal file
20
grids/utils.py
Normal 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
|
Loading…
Reference in a new issue