diff options
author | Alban Gruin | 2017-10-19 21:48:39 +0200 |
---|---|---|
committer | Alban Gruin | 2017-10-22 13:16:02 +0200 |
commit | f033f310ac8331de24a5fc2028ba22978c1d941e (patch) | |
tree | f106d4983b94287ebcd44beacbd081bb78743d4d /models.py | |
parent | 05b8c81e21dbd33680683238ee044d20a9882a04 (diff) |
Adaptation de corresponds_to() et des tests de parsage
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -97,12 +97,15 @@ class Group(models.Model): hidden = models.BooleanField(verbose_name="caché", default=False) - def corresponds_to(self, timetable_id, mention, subgroup, td, tp): + def corresponds_to(self, timetable_id, mention, subgroup): + subgroup_corresponds = True + if self.subgroup is not None and subgroup is not None: + subgroup_corresponds = subgroup.startswith(self.subgroup) or \ + self.subgroup.startswith(subgroup) + return self.timetable.id == timetable_id and \ self.mention.startswith(mention) and \ - (self.subgroup == subgroup or self.subgroup is None) and \ - (self.td == td or self.td is None or td is None) and \ - (self.tp == tp or self.tp is None or tp is None) + subgroup_corresponds @property def group_info(self): |