Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 import random | |
2 from datetime import datetime | |
3 | |
4 def teamsort(value, basedate="1970-01-01", column=0): | |
5 base = datetime.strptime(basedate, "%Y-%m-%d") | |
6 def randdiff(entry): | |
7 date = datetime.strptime(entry[column], "%Y-%m-%d") | |
8 diff = (date - base).days | |
9 return diff * 0.2 + random.randrange(diff) * 0.8 | |
10 return sorted(value, key=randdiff) | |
OLD | NEW |