Module database
Support Team avatar
Written by Support Team
Updated over a week ago

The py_cerebro.database module contains a description of the classes used to access the database.

Classes

py_cerebro.database.Database

classpy_cerebro.database.Database(db_host, db_port, db_timeout=5, db_reconn_count=3)

Parameters:

  • db_host (string) – host name.

  • db_port (int) – port.

  • db_timeout (int) – timeout to disconnect from the database in seconds.

  • db_reconn_count (int) – number of connection attempts.

The Database class is designed to establish connection to a database, contains a set of methods that perform standard Cerebro system queries and also the ability to execute arbitrary SQL queries.

# establish a connection to the database 

if db.connect_from_cerebro_client() != 0: #Trying to establish a connection using the running Cerebro client.
# If doesn't work, set up a connection using login and password
db.connect('user', 'password')

Note

The class contains functions that change the properties of tasks, which can take an array of identifiers as input. If you need to set multiple tasks to the same property value, prefer to use the transfer of an array of identifiers as an argument instead of using loops. This will significantly increase productivity.

# Usage identifier arrays

to_do_task_list = db.to_do_task_list(db.current_user_id(), True) # get a list of tasks for the current user

tsks = set()

for task in to_do_task_list:
tsks.add(task[dbtypes.TASK_DATA_ID])

db.task_set_priority(tsks,
dbtypes.TASK_PRIORITY_ABOVE_NORMAL) #set multiple tasks a higher priority than usual

Methods

activities()

Result:

table of activities.

Table fields described in dbtypes module: ACTIVITY_DATA_...

add_attachment()

add_attachment(message_id, carga, filename, thumbnails, description, as_link)

Parameters:

  • message_id (int) – message ID.

  • carga (py_cerebro.cargador.Cargador) – an object of cargador.Cargador class, for importing files into a file storage.

    star_border

  • filename (string) – full path to the file.

  • thumbnails – list of paths to sketch files (no more than three). The size of thumbnails should be 512x512. JPG or PNG format.

  • description (string) – comments to attachments.

  • as_link (bool) – a way to add a file to a message: True - the file is added as a link; False - the file is added as an attachment, that is, it is imported into the file storage (Cargador).

Adding an attachment to a message.

Usage for sketch generation

If the file is an image or video, you can add thumbnails for it. You can add up to 3 thumbnails (first, middle, last frames). You can use the Mirada program to generate sketches. It comes with the Cerebro distribution.

#Example of sketches generation via Mirada

gen_path = os.path.dirname(filename) # take the directory of the added file as the directory for generating thumbnails
mirada_path = './mirada' # path to the Mirada executable file

# launch Mirada with the necessary keys
res_code = subprocess.call([mirada_path, filename, '-temp', gen_path, '-hide'])
#-temp - directory for generating thumbnails
#-hide - key to launch Mirada in hidden mode (without loading the graphical interface) to generate thumbnails.

if res_code != 0:
raise Exception("Mirada returned bad exit-status.\n" + mirada_path);

#look for sketches generated by Mirada.
#A sketch name is formed from the file name, date and time of generation - filename_yyyymmdd_hhmmss_thumb[number].jpg
#For example: test.mov_20120305_112354_thumb1.jpg - the first thumbnail of test.mov video

thumbnails = list()
for f in os.listdir(gen_path):
if fnmatch.fnmatch(f, os.path.basename(filename) + '_*_thumb?.jpg'):
thumbnails.append(gen_path + '/' + f)

thumbnails.sort()

You can use other programs for sketch generation, for example, ffmpeg.

#An example of generating thumbnails using ffmpeg.
#In order to generate thumbnails using ffmpeg, you need to know the duration of the video in advance,
# to get the middle and the last frames correctly .
#Let's take a video lasting 30 seconds as an example.

thumbnails = list() # a list of files for sketches thumbnails.append(filename + '_thumb1.jpg')
thumbnails.append(filename + '_thumb2.jpg')
thumbnails.append(filename + '_thumb3.jpg')

subprocess.call(['ffmpeg', '-i', filename, '-s', '512x512', '-an', '-ss', '00:00:00', '-r', 1, '-vframes', 1, '-y', thumbnails[0]])
subprocess.call(['ffmpeg', '-i', filename, '-s', '512x512', '-an', '-ss', '15:00:00', '-r', 1, '-vframes', 1, '-y', thumbnails[1]])
subprocess.call(['ffmpeg', '-i', filename, '-s', '512x512', '-an', '-ss', '30:00:00', '-r', 1, '-vframes', 1, '-y', thumbnails[2]])
# You can see the keys description in ffmpeg documentation

add_client_review()

add_client_review(task_id, message_id, html_text)

Parameters:

  • task_id (int) – task identificator.

  • message_id (int) – message identifier to which the reply is written..

  • html_text (string) – text of a message in html format.

Result:

ID of a new message

Result type:

Adds a «Customer Review» message.

add_definition()

add_definition(task_id, html_text)

Parameters:

  • task_id (int) – task identificator.

  • html_text (string) – text of a message in html format.

Result:

new message ID

Result type:

Adds a “Task Statement” message.

add_note()

add_note(task_id, message_id, html_text)

Parameters:

  • task_id (int) – task identificator.

  • message_id (int) – ID of the message to which the reply is written.

  • html_text (string) – text of a message in html format.

Result:

new message ID.

Result type:

Adds a «Note» message.

add_report()

add_report(task_id, message_id, html_text, minutes)

Parameters:

  • task_id (int) – task identificator.

  • message_id (int) – ID of the message to which the reply is written

  • html_text (string) – text of a message in html format.

  • minutes (int) – stated reporting time in minutes.

Result:

new message ID.

Result type:

It is very important to set the time in reports. If minutes is 0 or None, the report will not be included in the statistics.

Adds a message of "Report" type.

add_resource_report()

add_resource_report(task_id, message_id, resource_id, html_text, minutes)

Parameters:

  • task_id (int) – task identificator.

  • message_id (int) – ID of the message to which the reply is written

  • resource_id (int) – ID of the material resource for which the report is written.

  • html_text (string) – text of a message in html format.

  • minutes (int) – stated reporting time in minutes.

Result:

new message ID

Result type:

Adds a message of the “Resource Report” type.

add_review()

add_review(task_id, message_id, html_text, minutes=None)

Parameters:

  • task_id (int) – task identificator.

  • message_id (int) – ID of the message to which the reply is written

  • html_text (string) – text of a message in html format.

  • minutes (int) – accepted time in minutes.

Result:

new message ID

Result type:

Adds a message of the “Review” type.

add_task()

add_task(parent_id, name, activity_id=0)

Parameters:

  • parent_id (int) – parent task identificator.

  • name (string) – new task name.

  • activity_id (int) – activity type identifier. The default is “0” (No type of activity).

Result:

new task ID

New task creation. The task name cannot contain the following characters: \ / # : ? & „ » , + |

Note

To send a notification about a new task to a user, you need to create a message of the "Task Statement" type in the task.

attachment_hashtags()

attachment_hashtags(attachment_id)

Parameters:

attachment_id (int, set(int, ) или list(int,)) – attachment identifier or an array of attachment identifiers.

Gets hashtags of the attachment.

Note

Recommended for attachments with the ATTACHMENT_DATA_TAG tag value: ATTACHMENT_TAG_FILE or ATTACHMENT_TAG_LINK.

attachment_remove_hashtags()

attachment_remove_hashtags(attachment_id, hashtags)

Parameters:

  • attachment_id (int, set(int, ) или list(int, )) – attachment identifier or an array of attachment identifiers.

  • hashtags (string, set(string, ) или list(string, )) – list of hashtags (each hashtag must be one word without spaces).

Removes hashtags from their attachments.

Note

Recommended for attachments with the ATTACHMENT_DATA_TAG tag value: ATTACHMENT_TAG_FILE or ATTACHMENT_TAG_LINK.

attachment_set_hashtags()

attachment_set_hashtags(attachment_id, hashtags)

Parameters:

  • attachment_id (int, set(int, ) или list(int, )) – attachment identifier or an array of attachment identifiers.

  • hashtags (string, set(string, ) или list(string, )) – list of hashtags (each hashtag must be one word without spaces).

Sets hashtags to attachments.

Note

Recommended for attachments with the ATTACHMENT_DATA_TAG tag value: ATTACHMENT_TAG_FILE or ATTACHMENT_TAG_LINK.

connect()

connect(db_user, db_password)

Parameters:

  • db_user (string) – username.

  • db_password (string) – user password.

Connection to a database with authorization.

connect_from_cerebro_client()

Connection to the database with an already authorized user on the Cerebro client. This connection is possible if the Cerebro client is already running on the same computer and is logged in. In this case there will be a connection to the database from the user logged in to the client. The connection in the client will not be interrupted, unlike the usual Database.connect connection via login and password, which will interrupt the established connection under the same user in the client.

Result:

status connection:

  • 0 - connection established;

  • 1 - connection not established (Cerebro client is running, but not logged in);

  • 2 - connection not established (Cerebro client is not running).

# Establish connection to the database
if db.connect_from_cerebro_client() != 0: # try to establish connection using the running Cerebro client
# If doesn't work, set up connection using login and password
db.connect(db_user, db_password)

copy_tasks()

copy_tasks(task_id, tasks_list, flags=79)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – The task identifier where the copied tasks are inserted.

  • tasks_list (set) – list of tuples of type [(id1, name1), (id2, name2),]..

  • flags (int) – copying flags..

Result:

a list of new tasks IDs.

Copies Tasks.

Detailed description of flags can be found in dbtypes module: COPY_TASKS_...

If a single task needs to be copied multiple times (replicated), send a tasks_list list of tuples with the same identifiers and different names. For example:

[(123, test_task02"), (123, test_task03"), (123, test_task04"), (123, test_task05")]

123 - Identifier of the task to be copied. "test_task02", test_task03", ... - names of new tasks.

# Copy tasks 1 (2 copies), 2 and 3 to task 0 
to_do_task_list = db.to_do_task_list(db.current_user_id(), True)
lst_copy = [(to_do_task_list[1][dbtypes.TASK_DATA_ID], 'Copy of task 1(1)'),
(to_do_task_list[1][dbtypes.TASK_DATA_ID], 'Copy of task 1(2)'),
(to_do_task_list[2][dbtypes.TASK_DATA_ID], 'Copy of task 2'),
(to_do_task_list[3][dbtypes.TASK_DATA_ID], 'Copy of task 3')] db.copy_tasks(to_do_task_list[0][dbtypes.TASK_DATA_ID], lst_copy)
# 4 new tasks added to task 0

current_user_id()

current_user_id()

Result:

user ID used for login

drop_link_tasks()

drop_link_tasks(link_id)

Parameters:

link_id (int) – link identifier.

Removes link between 2 tasks.

execute()

execute(query, *parameters)

Parameters:

  • query (string) – request text.

  • parameters – list of query specification.

Executes the query and returns the result. The result is presented as a table (a list of tuples).

message()

message(message_id)

Parameters:

message_id (int) – message identificator.

Result:

данные сообщения.

The table fields are described in the dbtypes module: MESSAGE_DATA_... Message types are described in the dbtypes module: MESSAGE_TYPE_...

message_attachments()

message_attachments(message_id)

Parameters:

message_id (int, set(int, ) или list(int, )) – message identifier or message ID array.

Result:

a table of message(s) file attachments

The table fields are described in the dbtypes module: ATTACHMENT_DATA_...

One attachment can represent from 1 to 5 records in the table. Attachment records are combined with a group identifier - ATTACHMENT_DATA_GROUP_ID. Records of one attachment are distinguished by the ATTACHMENT_DATA_TAG tag, and indicate one or another property of the attachment.

There are two types of attachments: a file and a link to a file. In the first case, the attachment has an entry with the ATTACHMENT_TAG_FILE tag, which contains the hash of the file located in the Cargador file storage. If the file is attached to the message as a link, then there is an entry with the ATTACHMENT_TAG_LINK tag. This record does not have a hash and the name field ATTACHMENT_DATA_FILE_NAME contains the full path to the file. An entry with the tag ATTACHMENT_TAG_REVIEW is only present if a review from the Mirada review tool has been added to the file. Entries with the thumbnail tag ATTACHMENT_TAG_THUMB... are only present if the file is an image or video. In the case of an image there is only one ATTACHMENT_TAG_THUMB1 entry, if a video file there are three entries.

message_hashtags()

message_hashtags(message_id)

Parameters:

message_id (int, set(int, ) или list(int, )) – message identifier or message ID array.

Gets hashtags of messages.

message_remove_hashtags()

message_remove_hashtags(message_id, hashtags)

Parameters:

  • message_id (int, set(int, ) или list(int, )) – message identifier or message ID array.

  • hashtags (string, set(string, ) или list(string, )) – a list of hashtags (each hashtag must be one word without spaces).

Removes hashtags from messages

message_set_hashtags()

message_set_hashtags(message_id, hashtags)

Parameters:

  • message_id (int, set(int, ) или list(int, )) – message identifier or message ID array.

  • hashtags (string, set(string, ) или list(string, )) – a list of hashtags (each hashtag must be one word without spaces).

Sets hashtags on messages.

messages()

messages(message_ids)

Parameters:

message_id (int, set(int, ) или list(int, )) – message(s) identifier

Result:

message(s) data.

The table fields are described in the dbtypes module: MESSAGE_DATA_... Message types are described in the dbtypes module: MESSAGE_TYPE_...

project_tags()

project_tags(project_id)

Parameters:

project_id (int) – project identificator

Result:

Project tag table. The table contains all the tags that can be set on the project tasks.

The table fields are described in the dbtypes module: TAG_DATA_...

root_tasks()

root_tasks()

Result:

a table of root tasks

The table fields are described in the dbtypes module: TASK_DATA_...

set_link_tasks()

set_link_tasks(first_task_id, second_task_id)

Parameters:

  • first_task_id (int) – ID of the task from which the connection is made.

  • second_task_id (int) – ID of the task to which the connection is made.

Result:

link ID

Result type:

Creates link between 2 tasks.

statuses()

statuses()

Result:

a table of all statuses.

The table fields are described in the dbtypes module: STATUS_DATA_...

tag_enums()

tag_enums(tag_id)

Parameters:

tag_id (int) – tag identifier.

Result:

Tag enumeration table. The table contains enumerations that can be set as the tag value.

The table fields are described in the dbtypes module: TAG_ENUM_DATA_...

task()

task(task_id)

Parameters:

task_id (int) – task identificator.

Result:

task data.

The table fields are described in the dbtypes module: TASK_DATA_...

task_allocated()

task_allocated(task_id)

Parameters:

task_id (int) – task identificator.

Result:

a table of assigned users (executors) to a task.

Table fields are described in the dbtypes module: TASK_ALLOCATED_...

task_attachments()

task_attachments(task_id)

Parameters:

task_id (int, set(int, ) или list(int, )) – task identifier or task identifier array.

Result:

table of task(s) file attachments.

The table fields are described in the dbtypes module: ATTACHMENT_DATA_...

One attachment can represent from 1 to 5 records in the table. Attachment records are combined with a group identifier - ATTACHMENT_DATA_GROUP_ID. Records of one attachment are distinguished by the ATTACHMENT_DATA_TAG tag, and indicate one or another property of the attachment.

There are two types of attachments: a file and a link to a file. In the first case, the attachment has an entry with the ATTACHMENT_TAG_FILE tag, which contains the hash of the file located in the Cargador file storage. If the file is attached to the message as a link, then there is an entry with the ATTACHMENT_TAG_LINK tag. This record does not have a hash and the name field ATTACHMENT_DATA_FILE_NAME contains the full path to the file. An entry with the tag ATTACHMENT_TAG_REVIEW is only present if a review from the Mirada review tool has been added to the file. Entries with the thumbnail tag ATTACHMENT_TAG_THUMB... are only present if the file is an image or video. In the case of an image there is only one ATTACHMENT_TAG_THUMB1 entry, if a video file there are three entries.

task_by_url()

task_by_url(url)

Parameters:

url (string) – path to the task.

Result:

task ID.

Returns the task ID along the task path. For example, path to a task: “/Test project/test”.

Note

Task paths are case sensitive.

task_children()

task_children(task_id)

Parameters:

task_id (int) – task identificator

Result:

subtasks table.

task_definition()

task_definition(task_id)

Parameters:

task_id (int) – task identificator.

Result:

message data of the Definition type.

The table fields are described in the dbtypes module: MESSAGE_DATA_...

task_hashtags()

task_hashtags(task_id)

Parameters:

task_id (int, set(int, ) или list(int, )) – task identificator or array of tasks identificators

Gets task hashtags.

# Work with task hashtags
to_do_task_list = db.to_do_task_list(db.current_user_id(), True) db.task_set_hashtags(to_do_task_list[0][dbtypes.TASK_DATA_ID], {„hashtag1“, „hashtag2“, „hashtag3“}) # assign an array of hashtags to the task
db.task_remove_hashtags(to_do_task_list[0][dbtypes.TASK_DATA_ID], „hashtag2“) # removes hashtags
hashtags = db.task_hashtags(to_do_task_list[0][dbtypes.TASK_DATA_ID]) # get task hashtags
print(„Task hashtags „, hashtags) # print hashtags

task_links()

task_links(task_id)

Parameters:

task_id (int) – task identificator.

Result:

task links table.

The table fields are described in the dbtypes module: TASK_LINK_...

task_messages()

task_messages(task_id)

Parameters:

task_id (int) – task identificator.

Result:

task messages table.

The table fields are described in the dbtypes module: MESSAGE_DATA_... Message types are described in the dbtypes module: MESSAGE_TYPE_...

task_possible_statuses()

task_possible_statuses(task_id)

Parameters:

task_id (int) – task identificator.

Result:

table of statuses that can be set for a task.

The table fields are described in the dbtypes module: STATUS_DATA_...

In the Cerebro system, switching permissions for each status are configured separately. In addition, each status has a heredity flag. Only those statuses that have this flag enabled can be set to container tasks. Therefore, the list of possible statuses depends on the user rights, current status, as well as the presence/absence of subtasks for the task.

task_remove_allocated()

task_remove_allocated(task_id, user_id)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of tasks identificators

  • user_id (int, set(int, ) или list(int, )) – user/material resource identifier or array of user/material resource identifiers.

Removes an executor from a task.

task_remove_hashtags()

task_remove_hashtags(task_id, hashtags)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers

  • hashtags (string, set(string, ) или list(string, )) – a list of hashtags (each hashtag must be one word without spaces).

Removes task hashtags.

task_set_activity()

task_set_activity(task_id, activity_id)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers

  • activity_id (int) – activity identifier.

Defines activity type of the task(s). Activity ID = 0 changes the activity type of the task to “No activity type”.

task_set_allocated()

task_set_allocated(task_id, user_id)

Параметры:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers

  • user_id (int, set(int, ) или list(int, )) – user/material resource identifier or array of user/material resource identifiers.

Assigns a task executor.

Note

To send a notification to the executor about an assigned task, the task must contain a message of the Definition type.

task_set_budget()

task_set_budget(task_id, budget)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers

  • budget (float) – budget amount in conventional units.

Sets the budget for the task.

When setting the budget to None, the task's own budget is reset and calculated from subtasks.

task_set_finish()

task_set_finish(task_id, time)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers

  • time (float) – time in days from 01/01/2000 (UTC).

Sets the end time of the task(s) in days from 01/01/2000 in UTC.

The time = None argument resets the task's set end time, in this case the end time is calculated based on the scheduled time for the task and the schedule.

db.task_set_finish(task_id, 4506.75) # finish time 03.05.2012 18:00 UTC

An example of setting the end time of a task 3 days from the current one

import datetime

datetime_now = datetime.datetime.utcnow()
datetime_2000 = datetime.datetime(2000, 1, 1)
timedelta = datetime_now - datetime_2000
days = timedelta.total_seconds()/(24*60*60) + 3

db.task_set_finish(task_id, days)

task_set_flag()

task_set_flag(task_id, flag, is_set)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • flag (int) – flag value.

  • is_set (bool) – flag set/reset attribute.

Sets a flag for a task. If the is_set argument is True, then the flag is set, otherwise it is reset.

# Mark a task as archived
db.task_set_flag(task_id, dbtypes.TASK_FLAG_ARCHIVED, True)

The values of task flags are described in the dbtypes module: TASK_FLAG_...

task_set_hashtags()

task_set_hashtags(task_id, hashtags)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • hashtags (string, set(string, ) или list(string, )) – list of hashtags (each hashtag must be one word without spaces).

Sets hashtags for tasks.

task_set_name()

task_set_name(task_id, name)

Parameters:

  • task_id (int) – task identifiers.

  • name (string) – task new name.

Sets new task name. The new name cannot contain the following symbols: \ / # : ? & „ » , + |.

task_set_planned_time()

task_set_planned_time(task_id, hours)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • hours (float) – hours scheduled for the task.

Sets the scheduled task(s) time in hours. When you set the hours argument to None, the scheduled task time is reset. After resetting, the scheduled time is calculated based on the task calendar and schedule.

task_set_priority()

task_set_priority(task_id, prior)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • prior (int) – priority value.

Sets the task priority.

Priority values are described in the dbtypes module: TASK_PRIORITY_...

task_set_progress()

task_set_progress(task_id, progress)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • progress (int) – progress value.

Sets the progress of a task. When progress is set to 100, the task is considered to be Done. When progress is set to None, the task's own progress is reset and calculated from subtasks.

task_set_start()

task_set_start(task_id, time)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • time (float) – time in days from 01.01.2000.

Sets the start time of the task in days from 01/01/2000 in UTC

The time = None argument resets the set start time of the task. After a reset, the start time is calculated based on the task links and schedule.

db.task_set_start({task_id, task_id1}, 4506.375) # start time 03.05.2012 9:00 UTC

Example how to set task start time to current.

import datetime 

datetime_now = datetime.datetime.utcnow()
datetime_2000 = datetime.datetime(2000, 1, 1)
timedelta = datetime_now - datetime_2000
days = timedelta.total_seconds()/(24*60*60)

db.task_set_start(task_id, days)

task_set_status()

task_set_status(task_id, status_id)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • status_id (int) – status identifier.

Sets task status. Status identifier = None changes task status to "No status".

task_set_tag_enum()

task_set_tag_enum(task_id, enum_id, is_set)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • enum_id (int, set(int, ) или list(int, )) – an enumeration identifier or an array of enumeration identifiers.

  • is_set (bool) – enumeration set/reset attribute.

Sets or removes a tag value of enumeration or multiple enumeration type for task(s). In cases with a tag of the multiple enumeration type, the function adds/removes enumerations to the tag value. In cases with the enumeration type, the previous established enumeration is replaced.

task_set_tag_float()

task_set_tag_float(task_id, tag_id, value)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • tag_id (int) – tag identifier.

  • value (float) – tag value.

Sets a tag value of floating point number for the task(s).

task_set_tag_int()

task_set_tag_int(task_id, tag_id, value)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • tag_id (int) – tag identifier.

  • value (int) – tag value.

Sets an integer tag value for the task(s).

task_set_tag_string()

task_set_tag_string(task_id, tag_id, value)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • tag_id (int) – tag identifier.

  • value (string) – tag value.

Sets a string tag value for the task(s).

task_tag_enums()

task_tag_enums(task_id, tag_id)

Parameters:

  • task_id (int) – task identifier.

  • tag_id (int) – tag identifier.

Result:

таблица установленных на задачу перечислений тега.

The table is described in the dbtypes module: TASK_TAG_ENUM_...

task_tag_reset()

task_tag_reset(task_id, tag_id)

Parameters:

  • task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

  • tag_id (int) – tag identifier.

Resets the tag value for the task(s).

task_tags()

task_tags(task_id)

Parameters:

task_id (int) – task identifier.

Result:

table of tag values set for the task.

The table fields are described in the dbtypes module: TASK_TAG_DATA_...

tasks()

tasks(task_ids)

Parameters:

task_id (int, set(int, ) или list(int, )) – task identifiers or array of task identifiers.

Result:

data on the task(s).

The table fields are described in the dbtypes module: TASK_DATA_...

to_do_task_list()

to_do_task_list(user_id, with_done_task)

Parameters:

  • user_id (int, set(int, ) или list(int, )) – user/material resource identifier or array of user/material resource identifiers.

  • bool with_done_task: если равен True, то возвратится список вместе с выполненными (прогресс 100%) задачами, иначе без них.

Result:

the table of tasks on which the user is assigned as an executor.

The table fields are described in the dbtypes module: TASK_DATA_...

users()

users()

Result:

table of users or material resources.

The table fields are described in the dbtypes module: USER_DATA_... The material resource has the USER_FLAG_IS_RESOURCE flag set. You can check this flag using the cclib.has_flag function:

if cclib.has_flag(user[dbtypes.USER_DATA_FLAGS], dbtypes.USER_FLAG_IS_RESOURCE): #if the material resource of the action

Did this answer your question?