def addActivity(self, id, split_mode='and', join_mode='and', self_assignable=1, start_mode=0, finish_mode=0, subflow='', push_application='', application='', title='', parameters='', description='', kind = 'standard', complete_automatically=1, REQUEST=None): """ adds the activity and eventually sets the process begin and end activity """ a = activity(id=id, join_mode=join_mode, split_mode=split_mode, self_assignable=self_assignable, start_mode=start_mode, finish_mode=finish_mode, subflow=subflow, push_application=push_application, application=application, title=title, parameters=parameters, description=description, complete_automatically=complete_automatically, kind=kind) self._setObject(id, a) if REQUEST: REQUEST.RESPONSE.redirect('index_html')
def addActivity(self, id, split_mode='and', join_mode='and', auto_push_mode=0, start_mode=0, finish_mode=0, subflow='', push_application='', application='', title='', parameters='', description='', limit=0, kind = 'standard', REQUEST=None): """ adds the activity """ a = activity(id=id, process_id=self.id, join_mode=join_mode, split_mode=split_mode, auto_push_mode=auto_push_mode, start_mode=start_mode, finish_mode=finish_mode, subflow=subflow, push_application=push_application, application=application, title=title, parameters=parameters, description=description, limit=limit, kind=kind) self._setObject(id, a) if REQUEST: REQUEST.RESPONSE.redirect('index_html')
def new_activity_config(): if request.method == 'POST': NombreActividad = request.form['name'] time_ = request.form['durationOfActivity'] root = 'db/'+ datetime.now().strftime("%d-%m-%Y-%H-%M-%S") os.makedirs(root, exist_ok=True) act = activity(root, mg, NombreActividad, time_) return jsonify(act.get_data()) abort(404, description="Resource not found")
def set_a_activity(self,activity_name,activity_money,activity_time,activity_position,activity_brief,friends_in): self.get_from_cookie() client=self.getclient(self.access_token,self.expires_in) self.get_from_cookie() hostinfor=self.get_user_info_weibo() newactivity=activity(activity_name,activity_money,activity_time,activity_position,activity_brief,friends_in,self.uid,hostinfor,client) self.hostlist.append(newactivity.activity_id) self.save() return newactivity.activity_id
def main_program(): user_in = "" end_work = 0 task1 = activity() task1.start_act() task1.project = "TIME_MGR" task1.comments = "First task ever !" while end_work != "1": print("Press '0' to stop counter") user_in = input() if user_in == "0": end_work = "1" task1.end_act() task1.export2json()
def attend_activity(self,activity_id): a=activity(activity_id=activity_id) self.inlist.append(activity_id) index=-1 for people in a.people: if int(people[u'uid'])==int(self.uid): index=a.people.index(people) print a.people[index][u'screen_name'] break a.people[index][u'state']='in' ifchange=True for people in a.people: if people['state']=="in": ifchange=True else: ifchange=False break if ifchange: a.state="people_all_in" a.save() self.save()
def sign(username,passwd): a=activity.activity(username,passwd) a.sign()
def haiyun(username,passwd): a=activity.activity(username,passwd) a.haiyun()
def get_activity_by_id(db_conn, id): cursor = db_conn.cursor() query = ''' WITH tt_columns AS ( SELECT ac.title AS title, dt.label AS data_type_label, ac.activity AS activity FROM tb_activity_column ac INNER JOIN tb_data_type dt ON ac.data_type = dt.data_type WHERE ac.disabled = FALSE ORDER BY ac.activity, ac.number ), tt_rows AS ( SELECT ar.title AS title, ar.activity AS activity FROM tb_activity_row ar WHERE ar.disabled = FALSE ORDER BY ar.activity, ar.number ), tt_activity_with_columns AS ( SELECT a.activity, array_agg(ttc.title) AS column_titles, array_agg(ttc.data_type_label) AS column_data_type_labels FROM tb_activity a INNER JOIN tt_columns ttc ON a.activity = ttc.activity WHERE a.disabled = FALSE GROUP BY a.activity ), tt_activity_with_rows AS ( SELECT a.activity, array_agg(ttr.title) AS row_titles FROM tb_activity a INNER JOIN tt_rows ttr ON a.activity = ttr.activity WHERE a.disabled = FALSE GROUP BY a.activity ) SELECT a.activity, a.title, at.label, a.instructions, ttac.column_titles, ttac.column_data_type_labels, ttar.row_titles FROM tb_activity a INNER JOIN tb_activity_type at ON a.activity_type = at.activity_type INNER JOIN tt_activity_with_columns ttac ON a.activity = ttac.activity INNER JOIN tt_activity_with_rows ttar ON a.activity = ttar.activity WHERE a.activity = %(id)s AND a.disabled = FALSE AND at.disabled = FALSE ''' cursor.execute(query, {"id":id}) rows = cursor.fetchall() if len(rows) > 1: raise ValueError, "IDs are not unique (this shouldn't be allowed by the schema)" if len(rows) < 1: raise ValueError, "Activity with that id does not exist: %s" % (id) # gather together our column information activity_column_titles = rows[0][4] activity_column_data_types = rows[0][5] activity_columns = [] for x in range(len(activity_column_titles)): activity_columns.append([activity_column_titles[x], activity_column_data_types[x]]) return activity.activity(rows[0][0], rows[0][1], rows[0][2], rows[0][3], activity_columns, rows[0][6])