Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mechanism for discovering tools in Canvas account, creating stub LtiTool records (#9) #287

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

roujiawang
Copy link
Contributor

@roujiawang roujiawang commented Nov 29, 2022

#9

To Do

  • Pull data from Canvas
  • Create instances using QuerySet API
  • Create a Django management command that pulls data and creates instances
  • Add public or visibility flag, set default to true, set all new instances created by process to false.
    • In models, add public BooleanField field for LTI Tool instances, and set this field to False by default.
    • For admin, display this field, and allow quick actions to change the value of this field for multiple instances.
    • In views, add a filter so that user view only lists tools whose public field is set to true.
    • Initial check on if this would affect any existing tool instance or newly-created tool instance in any negative way.
      • Able to create a new instance with the field set to True or set to False, and the tool will display/hide accordingly in user view
      • Able to change the field of an existing instance by visiting it or by actions, and the tool will display/hide accordingly in user view
      • The tool still needs a valid Canvas id to display; that is, some tool with an invalid Canvas id will not display to users even if this field is set as 'True'
  • Move canvasapi code into CanvasLtiManager or another adapter class
    • Create a custom class to encapsulate operations.
    • Adopt this class in the commands method.
  • Find a way to trigger process with a button in admin UI, use admin's Canvas token

@roujiawang roujiawang marked this pull request as draft November 29, 2022 18:46
@ssciolla ssciolla changed the title wrote a new command to fetch the information of available external to… Add mechanism for discovering tools in Canvas account, creating stub LtiTool records (#9) Nov 29, 2022
API_URL = options['api_url']
canvas = Canvas(API_URL, API_KEY)

primary_acount = canvas.get_account(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably make this account configurable. It want to be run on subaccounts.

# avoid duplicates: get_or_create
if not LtiTool.objects.filter(canvas_id=ex_tool.id).exists():
tool = LtiTool.objects.create(
name=ex_tool.name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll want to append something to the name like "(PLACEHOLDER)".

We're also using the fact that the ID not being set means the tool is "disabled" now, we probably will need to add a new column to indicate this if we're having a new process to run this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roujiawang added an is_public field now, so I think we're good on the second front. It might be useful to include placeholder text, not completely sold though.

course_nav_placement = CanvasPlacement.objects.get(name='Course Navigation')
for ex_tool in ex_tool_list:
# for now, only care about tools with placement "course_navigation"
if ex_tool.__dict__["course_navigation"] is not None \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably also want to make this configurable but this is fine hardcoding for now.

@jonespm
Copy link
Member

jonespm commented Nov 29, 2022

Good start on this feature idea! I'm sure we'll have a few more things to talk about with this and to get through the other ToDo items.

@ssciolla ssciolla removed their request for review July 13, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pull a list of tools available in Canvas and configure from this rather than configuring manually.
3 participants