base_model¶
-
class
egegrouper.base_model.
BaseModel
[source]¶ Model in MVC. Base class.
-
delete_exam
(self, exam_id)[source]¶ Delete examination from current storage.
Parameters: exam_id (str) – Examination ID.
-
delete_group
(self, group_id)[source]¶ Delete group of examinations from storage.
Parameters: group_id (str) – Group ID.
-
static
do_if_storage_opened
(method)[source]¶ Decorator. If storage is not opened AttributeError raised.
-
exam
(self, exam_id)[source]¶ Return examination object.
Parameters: exam_id (str) – Examination ID. Returns: Examination object. Return type: sme.Examination
-
exams
(self, group_id, meta_only)[source]¶ Return exams from selected group or groups.
Parameters: - group_id (str or list of str) – Group ID. If list, the union of sets of examinations from groups returned.
- meta_only (bool) – If True, only meta data returned.
Returns: exams – Examinations list.
Return type: list of sme.Examination
-
group_exam
(self, exam_id, group_ids, placed_in)[source]¶ Add and delete examination to and from groups.
Parameters: - exam_id (str) – Examination ID.
- group_ids (list of str) – Group IDs.
- placed_in (list of bool) – True for examinations to be placed in groups. Length of group_ids must be equal to length of placed_in.
-
group_info
(self, group_id)[source]¶ Return information about examinations of selected group.
Parameters: group_id (str) – Group ID Returns: - data (list of tuple) – Examination descriptions.
- headers (tuple) – Headers.
-
group_record
(self, group_id)[source]¶ Return attribute names and values of selected group.
Parameters: group_id (str) – Group ID. Returns: Attributes names and values for selected group. Return type: OrderedDict
-
insert_exam
(self, e)[source]¶ Add examination into current storage.
Parameters: exam (sme.Examination) – Examination object
-
insert_group
(self, name, description)[source]¶ Add new group of examinations.
Parameters: - name (str) – Name of new group.
- description (str) – Description for new group.
-
open_or_create_storage
(self, name)[source]¶ Open or create storage (if stoarge not exists).
Parameters: name (str) – Name of storage.
-
storage_exists
(self, name)[source]¶ Check if the storage exists.
Parameters: name (str) – Name of storage. Returns: True if exists, False otherwise. Return type: bool
-
storage_info
(self)[source]¶ Return common information about current storage.
Returns: - data (list of tuples) – Table with information about storage.
- headers (tuple) – Headers.
-
update_group_record
(self, group_id, attr)[source]¶ Update group record in storage.
Parameters: - group_id (str) – Group ID.
- attr (OrderedDict) – Attributes names and values.
-
where_exam
(self, exam_id)[source]¶ Return description of groups where examination in or not in.
Parameters: exam_id (str) – Examination ID. Returns: - group_records (list of tuple) – All group records.
- headers (list of str) – Names of group attributes.
- placed_in (list of bool) – True if exam in group, False otherwise.
-