Clean up code
This commit is contained in:
parent
678e064cfe
commit
f44a9f37d8
|
|
@ -31,7 +31,6 @@ export interface Location {
|
||||||
|
|
||||||
type RouteLocation = Location | string;
|
type RouteLocation = Location | string;
|
||||||
|
|
||||||
|
|
||||||
// TODO: ME_QUERY existiert an einem weiteren Ort. Dieser sollte entfernt werden.
|
// TODO: ME_QUERY existiert an einem weiteren Ort. Dieser sollte entfernt werden.
|
||||||
const defaultMe: MeQuery = {
|
const defaultMe: MeQuery = {
|
||||||
me: {
|
me: {
|
||||||
|
|
@ -80,10 +79,6 @@ const getCurrentClassName = (me: Me) => {
|
||||||
return currentClass ? currentClass.name : me.schoolClasses.length ? me.schoolClasses[0].name : '';
|
return currentClass ? currentClass.name : me.schoolClasses.length ? me.schoolClasses[0].name : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const getLastModuleLevel = (me: Me) => {
|
|
||||||
return me.lastModuleLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
const getMe = () => {
|
const getMe = () => {
|
||||||
const { result } = useQuery(ME_QUERY);
|
const { result } = useQuery(ME_QUERY);
|
||||||
|
|
||||||
|
|
@ -134,10 +129,6 @@ const meMixin = {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return getCurrentClassName(this.$data.me);
|
return getCurrentClassName(this.$data.me);
|
||||||
},
|
},
|
||||||
lastModuleLevel(): any {
|
|
||||||
// @ts-ignore
|
|
||||||
return getLastModuleLevel(this.$data.me);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,15 @@ from core.constants import DEFAULT_RICH_TEXT_FEATURES
|
||||||
from core.wagtail_utils import StrictHierarchyPage, get_default_settings
|
from core.wagtail_utils import StrictHierarchyPage, get_default_settings
|
||||||
from users.models import SchoolClass
|
from users.models import SchoolClass
|
||||||
|
|
||||||
FILTER_ATTRIBUTE_TYPE = (("all", "All"), ("exact", "Exact"))
|
EXACT = "exact"
|
||||||
|
|
||||||
|
FILTER_ATTRIBUTE_TYPE = (("all", "All"), (EXACT, "Exact"))
|
||||||
|
|
||||||
|
|
||||||
class ModuleLevel(models.Model):
|
class ModuleLevel(models.Model):
|
||||||
name = models.CharField(max_length=255, unique=True)
|
name = models.CharField(max_length=255, unique=True)
|
||||||
filter_attribute_type = models.CharField(
|
filter_attribute_type = models.CharField(
|
||||||
max_length=16, choices=FILTER_ATTRIBUTE_TYPE, default="exact"
|
max_length=16, choices=FILTER_ATTRIBUTE_TYPE, default=EXACT
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
@ -25,10 +27,6 @@ class ModuleLevel(models.Model):
|
||||||
verbose_name = _("module level")
|
verbose_name = _("module level")
|
||||||
|
|
||||||
|
|
||||||
def default_category():
|
|
||||||
return ModuleLevel.objects.first().pk
|
|
||||||
|
|
||||||
|
|
||||||
class ModuleCategory(models.Model):
|
class ModuleCategory(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("module type")
|
verbose_name = _("module type")
|
||||||
|
|
@ -37,7 +35,7 @@ class ModuleCategory(models.Model):
|
||||||
|
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
filter_attribute_type = models.CharField(
|
filter_attribute_type = models.CharField(
|
||||||
max_length=16, choices=FILTER_ATTRIBUTE_TYPE, default="exact"
|
max_length=16, choices=FILTER_ATTRIBUTE_TYPE, default=EXACT
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue