Total Complexity | 1 |
Total Lines | 16 |
Duplicated Lines | 100 % |
Changes | 4 | ||
Bugs | 0 | Features | 1 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | # coding: utf-8 |
||
21 | View Code Duplication | class Exercises(models.Model): |
|
|
|||
22 | |||
23 | """ |
||
24 | Exercises |
||
25 | """ |
||
26 | user = models.ForeignKey(User, on_delete=models.CASCADE) |
||
27 | sports = models.ForeignKey(Sports, on_delete=models.CASCADE) |
||
28 | comment = models.TextField() |
||
29 | duration = models.FloatField() |
||
30 | date_exercises = models.DateField(null=True) |
||
31 | hour_exercises = models.TimeField(null=True) |
||
32 | created = models.DateTimeField(auto_now_add=True) |
||
33 | modified = models.DateTimeField(auto_now=True) |
||
34 | |||
35 | def __str__(self): |
||
36 | return "%s (duration: %s)" % (self.sports, self.duration) |
||
37 |