diff options
author | Alban Gruin | 2017-11-16 19:01:27 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-16 19:01:27 +0100 |
commit | daa18b5fdc0284202f0efeefe562db2edc9f191f (patch) | |
tree | fd7fe03e3accb301a6111770220a6e1e0fe4746d | |
parent | 111c0fcba0692d175e42258f9aa814de6a2bb1ff (diff) | |
parent | b2c14a2db9b79dca007db5e32aefbf76ebd05fd1 (diff) |
Merge branch 'stable/0.11.z' into prod/pa1ch/0.11.zv0.11.2-pa1ch
-rw-r--r-- | __init__.py | 2 | ||||
-rw-r--r-- | management/commands/_private.py | 2 | ||||
-rw-r--r-- | models.py | 13 |
3 files changed, 10 insertions, 7 deletions
diff --git a/__init__.py b/__init__.py index 820bcfa..fd9e129 100644 --- a/__init__.py +++ b/__init__.py @@ -13,7 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. -VERSION = "0.11.1-pa1ch" +VERSION = "0.11.2-pa1ch" __version__ = VERSION default_app_config = "edt.apps.EdtConfig" diff --git a/management/commands/_private.py b/management/commands/_private.py index b663454..4dd9262 100644 --- a/management/commands/_private.py +++ b/management/commands/_private.py @@ -54,7 +54,7 @@ def get_event(timetable, event, event_week, today): end = add_time(date, event.endtime.text) # On ne traite pas le cours si il commence après le moment du traitement - if begin < today: + if today is not None and begin < today: return # Création de l’objet cours @@ -57,7 +57,8 @@ class Timetable(SlugModel): url = models.URLField(max_length=255, verbose_name="URL") slug = models.SlugField(max_length=64, default="") - last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat", null=True) + last_update_date = models.DateTimeField(verbose_name="dernière mise à jour Celcat", + null=True, blank=True) def __str__(self): return self.year.name + " " + self.name @@ -71,10 +72,12 @@ class Timetable(SlugModel): class GroupManager(Manager): def get_parents(self, group): - groups_criteria = Q(subgroup="") | Q(subgroup__startswith=group.subgroup) | \ - reduce(lambda x, y: x | y, - [Q(subgroup=group.subgroup[:i]) - for i in range(1, len(group.subgroup) + 1)]) + groups_criteria = Q(subgroup="") | Q(subgroup__startswith=group.subgroup) + + if len(group.subgroup) != 0: + groups_criteria |= reduce(lambda x, y: x | y, + [Q(subgroup=group.subgroup[:i]) + for i in range(1, len(group.subgroup) + 1)]) return self.get_queryset().filter(groups_criteria, mention=group.mention, timetable=group.timetable) |