Skip to content

Commit

Permalink
Supprime des fonctions inutiles (#6547)
Browse files Browse the repository at this point in the history
* Supprime la fonction inutilisée get_opinion_count
* Supprime la fonction inutilisée get_tuto_count
* Supprime la fonction inutilisée get_article_count
* Supprime la fonction inutilisée get_content_counts
  • Loading branch information
Arnaud-D authored Nov 1, 2023
1 parent 0a733a7 commit 59a44a2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
27 changes: 0 additions & 27 deletions zds/member/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,6 @@ def get_user_beta_contents_queryset(self, _type=None):
"""
return self.get_user_contents_queryset(_type).filter(sha_beta__isnull=False)

def get_content_count(self, _type=None):
"""
:param _type: if provided, request a specific type of content
:return: the count of contents with this user as author. Count all contents no only published one.
"""
if self.is_private():
return 0
return self.get_user_contents_queryset(_type).count()

def get_contents(self, _type=None):
"""
:param _type: if provided, request a specific type of content
Expand Down Expand Up @@ -231,12 +222,6 @@ def get_beta_contents(self, _type=None):
"""
return self.get_user_beta_contents_queryset(_type).all()

def get_tuto_count(self):
"""
:return: the count of tutorials with this user as author. Count all tutorials, no only published one.
"""
return self.get_content_count(_type="TUTORIAL")

def get_tutos(self):
"""
:return: All tutorials with this user as author.
Expand Down Expand Up @@ -269,12 +254,6 @@ def get_beta_tutos(self):
"""
return self.get_beta_contents(_type="TUTORIAL")

def get_article_count(self):
"""
:return: the count of articles with this user as author. Count all articles, no only published one.
"""
return self.get_content_count(_type="ARTICLE")

def get_articles(self):
"""
:return: All articles with this user as author.
Expand Down Expand Up @@ -307,12 +286,6 @@ def get_beta_articles(self):
"""
return self.get_beta_contents(_type="ARTICLE")

def get_opinion_count(self):
"""
:return: the count of opinions with this user as author. Count all opinions, no only published one.
"""
return self.get_content_count(_type="OPINION")

def get_opinions(self):
"""
:return: All opinions with this user as author.
Expand Down
22 changes: 0 additions & 22 deletions zds/member/tests/tests_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@ def test_get_topic_count(self):
# Should be 1
self.assertEqual(self.user1.get_topic_count(), 1)

def test_get_tuto_count(self):
# Start with 0
self.assertEqual(self.user1.get_tuto_count(), 0)
# Create Tuto !
minituto = PublishableContentFactory(type="TUTORIAL")
minituto.authors.add(self.user1.user)
minituto.gallery = GalleryFactory()
minituto.save()
# Should be 1
self.assertEqual(self.user1.get_tuto_count(), 1)

def test_get_tutos(self):
# Start with 0
self.assertEqual(len(self.user1.get_tutos()), 0)
Expand Down Expand Up @@ -140,17 +129,6 @@ def test_get_beta_tutos(self):
self.assertEqual(len(betatetutos), 1)
self.assertEqual(betatetuto, betatetutos[0])

def test_get_article_count(self):
# Start with 0
self.assertEqual(self.user1.get_tuto_count(), 0)
# Create article !
minituto = PublishableContentFactory(type="ARTICLE")
minituto.authors.add(self.user1.user)
minituto.gallery = GalleryFactory()
minituto.save()
# Should be 1
self.assertEqual(self.user1.get_article_count(), 1)

def test_get_articles(self):
# Start with 0
self.assertEqual(len(self.user1.get_articles()), 0)
Expand Down

0 comments on commit 59a44a2

Please sign in to comment.