add entry count to project widget
This commit is contained in:
parent
f9f1b6819c
commit
d03524e803
|
|
@ -3,7 +3,7 @@
|
||||||
<router-link :to="{name: 'project', params: {slug: slug}}" tag="div" class="project-widget__content">
|
<router-link :to="{name: 'project', params: {slug: slug}}" tag="div" class="project-widget__content">
|
||||||
<h3 class="project-widget__title">{{title}}</h3>
|
<h3 class="project-widget__title">{{title}}</h3>
|
||||||
|
|
||||||
<entry-count-widget entry-count="4"></entry-count-widget>
|
<entry-count-widget :entry-count="entriesCount"></entry-count-widget>
|
||||||
<owner-widget :name="owner"></owner-widget>
|
<owner-widget :name="owner"></owner-widget>
|
||||||
</router-link>
|
</router-link>
|
||||||
<widget-footer v-if="isOwner">
|
<widget-footer v-if="isOwner">
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
import WidgetFooter from '@/components/WidgetFooter';
|
import WidgetFooter from '@/components/WidgetFooter';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['title', 'appearance', 'slug', 'id', 'final', 'student', 'userId'],
|
props: ['title', 'appearance', 'slug', 'id', 'final', 'student', 'entriesCount', 'userId'],
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
WidgetFooter,
|
WidgetFooter,
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@ fragment ProjectParts on ProjectNode {
|
||||||
lastName
|
lastName
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
entriesCount
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ from users.models import UserRole, Role
|
||||||
|
|
||||||
class ProjectNode(DjangoObjectType):
|
class ProjectNode(DjangoObjectType):
|
||||||
pk = graphene.Int()
|
pk = graphene.Int()
|
||||||
|
entries_count = graphene.Int()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Project
|
model = Project
|
||||||
|
|
@ -19,6 +20,9 @@ class ProjectNode(DjangoObjectType):
|
||||||
def resolve_pk(self, *args, **kwargs):
|
def resolve_pk(self, *args, **kwargs):
|
||||||
return self.id
|
return self.id
|
||||||
|
|
||||||
|
def resolve_entries_count(self, *args, **kwargs):
|
||||||
|
return self.entries.count()
|
||||||
|
|
||||||
|
|
||||||
class ProjectEntryNode(DjangoObjectType):
|
class ProjectEntryNode(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ from users.schema import UserNode
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RoomEntryNode(DjangoObjectType):
|
class RoomEntryNode(DjangoObjectType):
|
||||||
pk = graphene.Int()
|
pk = graphene.Int()
|
||||||
author = UserNode()
|
author = UserNode()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue