timeclock.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:suite 作者: Staffjoy 项目源码 文件源码
def delete(self, org_id, location_id, role_id, user_id, timeclock_id):
        """
        deletes a timeclock record
        """

        timeclock = Timeclock.query.get_or_404(timeclock_id)
        user = User.query.get_or_404(user_id)
        original_start = timeclock.start
        original_stop = timeclock.stop

        try:
            db.session.delete(timeclock)
            db.session.commit()
        except Exception as exception:
            db.session.rollback()
            current_app.logger.error(str(exception))
            abort(400)

        if timeclock.user_id != g.current_user.id:
            alert_timeclock_change(None, org_id, location_id, role_id,
                                   original_start, original_stop, user,
                                   g.current_user)

        g.current_user.track_event("timeclock_deleted")
        return {}, 204
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号