-
Notifications
You must be signed in to change notification settings - Fork 14
/
module_item_configuration.py
43 lines (31 loc) · 1.48 KB
/
module_item_configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sqlalchemy as sa
from lms.db import BASE
__all__ = ["ModuleItemConfiguration"]
class ModuleItemConfiguration(BASE):
"""
A module item or assignment configuration.
When an LMS doesn't support LTI content-item selection/deep linking (so it
doesn't support storing an assignment's document URL in the LMS and passing
it back to us in launch requests) then we store the document URL in the
database instead.
Each persisted ModuleItemConfiguration object represents a DB-stored
assignment configuration, with the
``(tool_consumer_instance_guid, resource_link_id)`` launch params
identifying the LTI resource (module item or assignment) and the
``document_url`` being the URL of the document to be annotated.
"""
__tablename__ = "module_item_configurations"
__table_args__ = (
sa.UniqueConstraint("resource_link_id", "tool_consumer_instance_guid"),
)
id = sa.Column(sa.Integer, autoincrement=True, primary_key=True)
resource_link_id = sa.Column(sa.String, nullable=False)
"""The resource_link_id launch param of the module item or assignment."""
tool_consumer_instance_guid = sa.Column(sa.String, nullable=False)
"""
The tool_consumer_instance_guid launch param of the LMS.
This is needed because resource_link_id's aren't guaranteed to be unique
across different LMS's.
"""
document_url = sa.Column(sa.String, nullable=False)
"""The URL of the document to be annotated for this assignment."""