refs FOO-1166
* don't randomly sample from an array that's likely already usefully
ordered
* re-write sub_account recursive stuff so that a relation can be used,
and then use that relation to preload brand_configs, and to select
only necessary columns
* fix a bunch of callbacks so that you can actually save a slim
account object
* pass in an account/sharedbrandconfig object when we have one already,
instead of force reloading
Change-Id: Ia14b539617f338be507e7773da7ef9bc3907ec4c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/257443
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
closes OUT-1534
Scheduling of outcome import jobs will occur in a separate PS,
after this merges and OUT-1997 is merged too.
test plan:
- start up canvas
- generate api docs:
> docker-compose run --rm web bundle exec rake doc:api
- load api docs in http://canvas.docker/doc/api/index.html
- read over the "Outcomes CSV Format" and make sure it reads well
- read over the "Outcomes Import" and make sure it reads well
- obtain an access token:
https://community.canvaslms.com/docs/DOC-10806-4214724194
- request an outcome import, replace "canvas-path" and "token" values:
curl -F attachment=@<canvas-path>/spec/lib/outcomes/fixtures/demo.csv \
-F 'import_type=instructure_csv' \
-H "Authorization: Bearer <token>" \
http://canvas.docker/api/v1/accounts/1/outcome_imports
- in a rails console, confirm that the import was accepted:
> docker-compose run --rm web bin/rails console
% pp OutcomeImport.last
# confirm that the import is in the 'created' state, associated with
your user and associated with an account context
# note the "id" value for later use
% pp OutcomeImport.last.attachment
# confirm that the attachment is in the 'processed' state and has
the filename "test_outcomes_1.csv" passed in above
- request the status of the outcome import (should return a message
saying "The specified resource does not exist"):
curl -H "Authorization: Bearer <token>" \
http://canvas.docker/api/v1/accounts/1/outcome_imports/latest
- back in the rails console created above, manually transition
the import to "importing":
% OutcomeImport.last.job_started
- run the above curl command again, and this time the latest outcome
import should be returned, in the 'importing' state
- run the above curl command again, replacing "latest" with the "id"
value obtained above. it should return the same response as the
previous step.
Change-Id: Ice7d67b625b443cec70f531f2e673face6d6fbeb
Reviewed-on: https://gerrit.instructure.com/142024
Reviewed-by: Neil Gupta <ngupta@instructure.com>
Reviewed-by: Frank Murphy <fmurphy@instructure.com>
Tested-by: Jenkins
QA-Review: Frank Murphy <fmurphy@instructure.com>
Product-Review: Neil Gupta <ngupta@instructure.com>