def get_last_task(self):
        task = Tasks.find_one({
            'project': self.name,
        }, sort=[('created', DESCENDING)], fields={
            name: True for name in (
                'service', 'project', 'commit', 'plot',
                'created', 'status', 'success_percent',
            )
        })
        if task:
            return task
        else:
            raise TaskDoesNotExists()
Get last task
dataset/ETHPy150Open nvbn/coviolations_web/projects/models.py/Project.get_last_task