I am trying to grade a Google classroom of about 200 students and I have succeeded in grading each student on a .csv file. Is there a method that allows you to automatically fill and submit grades and comments on Google Classroom from a Google Sheet?
I have tried reading the .csv file and that works fine in a Python Script but writing the data to Google Classroom has been an issue.
With the Classroom API you should be able to push grades to your Course if you have either the student IDs or student emails in the Google Classroom to match on. You can't, however, push comments.
The workflow for pushing grades would be as follows:
If you don't have the Classroom course ID, retrieve it via the courses.list endpoint. Keep this handy for future use.
With the Course ID from step 1, create a CourseWork item via
the coursework.create function. You'll have to do this for each assignment you have. Make sure you keep the CourseWork IDs associated with each assignment for future reference.
If you only have the student emails, you'll have to get their Classroom IDs with the students.get endpoint. This will also need the Course ID from step 1.
Each CourseWork has a student submission object for each student, so you'll need to collect these student submission IDs for each student for the assignment. You can do this with the studentsubmissions.get endpoint.
With each of these student submission IDs, push the student's grade for the given assignment with the studentsubmissions.patch endpoint. You'll need the course, coursework, and studentSubmission IDs to push this grade.
Finally, return each of these grades with the studentsubmissions.return endpoint. Again, you'll need the course, coursework, and student submission IDs for this.
If you're using a spreadsheet, I imagine an example structure with all the data needed to do this would like as follows:
| Student Email | Student ID | Assignment 1 ID | Submission ID | Assignment 1 Grade |
| ------------- |:-------------:|:----------------:| ----------------:| ------------------ |
| Email 1 | student id 1 | courseWork 1 ID | submission 1 ID | grade #1 |
| Email 2 | student id 2 | courseWork 2 ID | submission 2 ID | grade #1 |
| ... | ... | ... | ... | ... |
Columns 3, 4, and 5 would repeat for each assignment you have. Documentation on how to write this code can be found here and here. If you're using Google Sheets, you can make an Apps Script to do all of this.
As for the comment functionality, again, we don't support that right now, but I encourage you to you can follow the reported feature request for updates here. I also recommend clicking “Me too!” at the top of the listed issue and posting any comments regarding your use case + need.
Hope this helps!
Related
I have a table in Airtable that contains rows of products that for the sake of brevity have these 4 fields.
Product Name | Category 1 | Category 2 | Category 3
Iam trying to figure out how I can build the following url structure upon build when all products are fetched via the Airtable API.
www.sitename.com/products/category1 and list all products that are in this category
www.sitename.com/products/category1/category2 and list all products that are in this category
www.sitename.com/products/category1/category2/category3 and list all products that are in this category
I need some pointers in how to set this up. I tried googling for an answer but had no good results.
Thank you!
This is a followup to an earlier question that I had posted and accepted an answer. I have a further question after getting feedback, and trying to post as a new question to hopefully get an answer.
Having discussed with users, the requirement just got more complex. What they actually do is something like a table in relational world with following columns (its denormalised with lot of repetitive data:
PartnerName | Service | Offered? |CurrentlyUsing | WeCouldSellThese |
XX | Baking | Yes |Competitor A, B | Product A |
XX | Baking | Yes |Competitor A, B | Product C |
XX | Baking | Yes |Competitor A, B | Product D |
XX | OnlyDough| Yes |Product A | Product C |
XX | Packing | No | | Product E |
Basically, they need to store information what is being used currently, and whether its currently offered by partner or not, they still try to sell them products (Offered Yes or No will both still lead to a market). There is a many-to-many relationship between service and product as well...which means there is a "3node" relationship - A particular partner for a particular product for a particular service, here are the 2 options I'm thinking of. The trouble with Option 1 is that Product A would have many To_Build outgoing relationships, so I dont have a way to figure out its for which partner.
Here are the options after I bring a new entity to split the relationship:
You can use an extra node (say, labelled "Build") to "reify" the "3-node relationship". For example:
By the way, you should also consider whether the Could_Offer relationship is redundant. For example, you could add an isOffered property to the Could_Build relationship and eliminate the Could_Offer relationship.
I'm creating a new app where users can be created. For example:
User
name:string, email:string
One of the requirements of the app is that the administrator in the future will be able to create new fields for this user. For example:
User
name:string, email:string, surname:string
So the administrator will be able to create new fields without telling the developer to do it.
How can this be achieved?
You can create a model called Field to store the fields (name, email, etc). Each user will have many fields and each field belongs to many users, so you need a association class (UserFields).
|------| |-----------| |-------|
| User |1--------*| UserField |*----------1| Field |
|------| |-----------| |-------|
For example:
users users_fields fields
------- ------------- --------
id userd_id field_id value id name
1 1 1 my name 1 name
1 2 my address 2 address
1 3 my email 3 email
Take a look on the rails guide to see how to set a has many through association: http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
i want to make a query for two column families at once... I'm using the cassandra-cql gem for rails and my column families are:
users
following
followers
user_count
message_count
messages
Now i want to get all messages from the people a user is following. Is there a kind of multiget with cassandra-cql or is there any other possibility by changing the datamodel to get this kind of data?
I would call your current data model a traditional entity/relational design. This would make sense to use with an SQL database. When you have a relational database you rely on joins to build your views that span multiple entities.
Cassandra does not have any ability to perform joins. So instead of modeling your data based on your entities and relations, you should model it based on how you intend to query it. For your example of 'all messages from the people a user is following' you might have a column family where the rowkey is the userid and the columns are all the messages from the people that user follows (where the column name is a timestamp+userid and the value is the message):
RowKey Columns
-------------------------------------------------------------------
| | TimeStamp0:UserA | TimeStamp1:UserB | TimeStamp2:UserA |
| UserID |------------------|------------------|------------------|
| | Message | Message | Message |
-------------------------------------------------------------------
You would probably also want a column family with all the messages a specific user has written (I'm assuming that the message is broadcast to all users instead of being addressed to one particular user):
RowKey Columns
--------------------------------------------------------
| | TimeStamp0 | TimeStamp1 | TimeStamp2 |
| UserID |------------|------------|-------------------|
| | Message | Message | Message |
--------------------------------------------------------
Now when you create a new message you will need to insert it multiple places. But when you need to list all messages from people a user is following you only need to fetch from one row (which is fast).
Obviously if you support updating or deleting messages you will need to do that everywhere that there is a copy of the message. You will also need to consider what should happen when a user follows or unfollows someone. There are multiple solutions to this problem and your solution will depend on how you want your application to behave.
I am writing a quite complex query in Ruby on Rails 3.1.3, and I am using find_by_sql.
But I noticed a very strange behaviour, even if I use find_by_sql with very simple queries.
Here is a simple example:
Let' say that I have two models and related tables:
Model 1: Company
Table 1: companies
fields: id, name, address
| id | name | address |
+----+------+-----------------+
| 1 | ACME | Bond street, 56 |
and:
Model 2: Employee
Table 2: employees
fields: id, name, age
| id | name | age |
+----+------+-----+
| 1 | Fred | 56 |
| 2 | Adam | 27 |
Here is what happens; if I write:
Company.find_by_sql("SELECT * FROM `employees`")
I get:
Company Load (0.3ms) SELECT * from `employees`
=> [#<Company id: 1, name: "Fred">, #<Company id: 2, name: "Adam">]
I only get the fields of employees whose names match the ones in companies (i.e., the field age is missing)!
No #attributes at all.
Is it a bug? Can anyone please help me?
The console uses pretty printing to output data from any instances returned by the query. Pretty printing is implemented automatically in the class by ActiveRecord according to the columns associated with that particular model, and won't therefore display attributes that do not belong to that particular model.
That does not mean however the attributes were not loaded into the instances. Pretty printing is just not showing them, but they are still there.
So if you just do:
Company.find_by_sql("SELECT * from employees").first.age
You should still get 56 according to your example.
try:
Employee.find_by_sql("SELECT * FROM `employees`")
If you're selecting from the employees table you will want to use the Employee model.
Try this instead
Employee.find_by_sql("SELECT id, name, age FROM `employees`")