Hi, I try to make a function that puts periods of time into a database. The function should only add periods that doesn't overlap any of the already registered ones.
But the function does not work, and I can't see what's wrong. Any idea? Thanks in advance for help! code from the controller file: ************ def addingperiod(): if request.args and request.args[0]: item_id=request.args[0] prerecords = db().select(db.period.ALL, orderby=db.period.begindate) if not session.timedelta2==timedelta(days=0): for prerecord in prerecords: if prerecord.theauth==auth.user_id: accepted1="true" accepted2="true" if previous.enddate: if item_id.vars.begindate < previousenddate: accepted1="false" if item_id.vars.enddate < prerecord.begindate: accepted2="false" if item_id.vars.enddate < prerecord.enddate: accepted2="false" previousenddate = prerecord.enddate if accepted1=="true": if accepted2=="true": period.append(item_id) redirect(URL(c=request.controller,f='goal')) ************