Commit Graph

2 Commits

Author SHA1 Message Date
Cody Cutrer 809904d8b6 add frozen_string_literal comment to migrations
Change-Id: Idf4ddb29567c1dfab9f01b09c7a1056367ae7b44
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261814
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-03-30 18:14:36 +00:00
Ryan Norton d790a76222 add body to submission draft in graphql
we need to add a 'body' field to the submission draft type
in graphql to allow us to store text entry drafts going forward.

Test Plan:
* run the db migration to add body to submission draft:
** bundle exec rake db:migrate:up VERSION=20190801215707

* create an assignment as a teacher
* add a student to that assignment
* run the following in the /graphiql endpoint to locate the
  submissions for that assignment

  ```query MyQuery {
  assignment(id: "1") {
    submissionsConnection(filter: {states: [unsubmitted, submitted, graded, pending_review]}) {
      nodes {
        _id
        submissionDraft {
          body
        }
      }
    }
  }
}```

** you should see a submission with a null submission draft

* in the rails console, you will need to add a submission
  draft with a body to that submission
** sub = Submission.find(1) // or whatever your submission ID is
** draft = SubmissionDraft.create!(submission: sub,
   submission_attempt = sub.attempt + 1)
** draft.body = 'some text'
** draft.save!
** sub.submission_drafts = [draft]
** sub.save!

* run the query in graphql again, and you should see something
  like:

```
{
  "data": {
    "assignment": {
      "submissionsConnection": {
        "nodes": [
          {
            "_id": "31",
            "submissionDraft": {
              "body": "some text"
            }
          }
        ]
      }
    }
  }
}
```

fixes COMMS-2263

Change-Id: I62877ac43727f02191c84a98e2609bd8f9987733
Reviewed-on: https://gerrit.instructure.com/203674
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Landon Gilbert-Bland <lbland@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Ryan Norton <rnorton@instructure.com>
2019-08-06 17:37:15 +00:00