How to access exams from XBlocks using EDX API? - openedx

my team and I have been given the task of creating some sort of street light notifications for exams in Open EDX, that is, if exam's due date is 3 weeks away, the color should be green, if the date is only a week away yellow and if the due date have passed the light should be red. The thing is we have access to courses list through the API of EDX but we can't figure out how to get exams through it, any ideas?
We have already consulted API routes for EDX https://github.com/edx/edx-platform/blob/master/lms/urls.py and conducted some tests with postman to the routes of courses but nothing.
Any help is appreciated!

You can use the Course Blocks API to return due dates. You'll have to include requested_fields=due parameter.
An example URL:
https://your.edx.installation/api/courses/v1/blocks/?course_id=course-v1%3AedX%2BDemoX%2BDemo_Course&depth=all&all_blocks=true&requested_fields=due

Related

I am trying to autofill a column based on text in the same row, but the references will be different categories and I'm getting ERROR thrown at me

I am trying to code a Google sheet for my mother's book keeping but I am hitting a wall. I have a number of categories that will be referenced and, depending on the category the monetary value will be changing.
Example.
Clerical $20/hr
Prop Mngt $35/hr
Admin $50/hr
Plus others I'm not aware of yet
I have tried this code =IF(SEARCH("Administration",$C8)>0,"$50") and it worked for the one keyword.
When I tried =IF(SEARCH("Administration",$C8)>0,"$50"),=IF(SEARCH("Clerical",$C8)>0,"$20") I was given ERROR.
How do I tell C8 to autofill D8 with the correct hourly rate? This will then feed D10 with =SUM(D8*E8) ???
Thank you for your help. I know just enough to know it's possible but not enough to grasp the issues I'm facing.
Try
=IF(not(iserror(SEARCH("Administration",$C8))),"$50",IF(not(iserror(SEARCH("Clerical",$C8))),"$20",""))
Another solution is to use this formula I think more understandable
=IFs(not(iserror(SEARCH("Administration",A1))),"$50",not(iserror(SEARCH("Clerical",A1))),"$20")

Auto email when a cell is populated

I will explain since coding is many years behind me but I feel this can be done.
We have a form that our employees fill out when they need to return to a job. This works fine, sends them an email that it was received and creates the sheet in google.
We then have the CSR fill out their name once they set up the callback.
Simple right?
Yes and no.
The employees know it was received but not that column c2 (or whatever) is now populated with the CSR name and was set.
What I am looking to do is have column c2 trigger an email back to the employee who filled out the form with certain data from the google sheet so they know it was addressed, by who and when.
I have seen similar codes but nothing that does exactly this. I can play with the column names etc. but I am cannot get it started.
Yes, brand new with google sheets and the last programming I did was DOS and Advanced Revelatinos about 20 years ago.
For argument sake here are the headers:
Date employee_email Customer Address Reason date_needed set_up_date CSR (CSR would be the trigger and it would send the customer, address, set_up_date and CSR name to it.
It sounds so simple yet after 6 hours at my EMT shift (less two calls) I have not gotten far.
Thank you again.
Any help, direction or solution would be great!

Trying to COUNTIFS date = this week (sunday-saturday)?

I'm building a spreadsheet that automatically gets a row added when I get an application on my form. Here is the link to the sheet. As you can see, the first tab is just a list of applications, with the location they've applied for, and the date. The second tab is a daily count for each location, which is eventually sent out as an email each night. I'd like to include weekly numbers, and maybe even an ongoing weekly comparison. e.g. # of apps today, this week (so far), last week, etc.
I'm no expert with this stuff and it's getting a bit over my head possibly. Any ideas on how to get this done smoothly?? Thanks a ton in advance!
Your problem (like many) is primarily a problem with the organization of your raw data.
On a new tab called MK.Help, I've put the following formula in cell A2:
=ARRAYFORMULA(QUERY(SPLIT(FLATTEN(Applications!A2:A&"|"&Applications!S2:S&"|"&FLOOR(Applications!S2:S-2,7)+2&"|"&Applications!B2:R),"|",0,0),"where Col4 is not null and Col2>="&I2))
Then I made a simple table on the right with some fairly straightforward COUNTIFS() that look like this:
=COUNTIFS($C:$C,H$2,$D:$D,$F3)
The layout of the data vertically is what's making the formulas relatively simple for the summary.

Google Sheet: IMPORTXML from Yahoo Finance [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I'm trying to import current stock price from yahoo finance. I used a formula from some website and it partially work. I only know how to tell it to look for a specific query and it worked fine for some other data point I need but the price change query changes from
"Fw(500) Pstart(10px) Fz(24px) C($dataRed)"
to
"Fw(500) Pstart(10px) Fz(24px) C($dataGreen)"
depending if the price is up or down for the day.
How do I modify the formula I'm using below to use the "or" operator in this case? so that it will pull the price down whether the stock is up or down for the day. Thanks!
Formula I'm using:
=IMPORTXML("https://finance.yahoo.com/quote/IBM","//span[#class='Fw(500) Pstart(10px) Fz(24px) C($dataRed)']")
I noticed the other answers did not work for me (they may have worked in the past), so I decided to post this solution. Just put the ticker in cell A1 and one or both of the below formulas somewhere else.
Price:
=IFNA(VALUE(IMPORTXML("https://finance.yahoo.com/quote/" & A1, "//*[#class=""D(ib) Mend(20px)""]/span[1]")))
Change:
=IFNA(VALUE(REGEXEXTRACT(IMPORTXML("https://finance.yahoo.com/quote/" & A1,"//*[#class=""D(ib) Mend(20px)""]/span[2]"), "^.*?\s")))
Currently using googlefinance but find it does not update often enough even when updates set to every minute so currently testing if below will allow updates at least with an F5 press within the sheet
This brings in the price and other information (dated 2022/09/27)
=IMPORTXML("https://finance.yahoo.com/quote/SAVA/", "//*[#id=""quote-header-info""]/div[3]/div[1]/div[1]")
If you just want the price: =IFNA(VALUE(IMPORTXML("https://finance.yahoo.com/quote/" & $A1, "//*[#class=""D(ib) Mend(20px)""]/span[1]")))
You could use a more dynamic/generic xpath that doesnt require such specific paths such as this:
This one pulls in both the price and the change:
=ARRAY_CONSTRAIN(transpose(IMPORTXML("https://finance.yahoo.com/quote/IBM:,"//*[#class='Mt(6px)']//span")),1,2)
If you just want the price:
=trim(IMPORTXML("https://finance.yahoo.com/quote/IBM","//*[#class='Mt(6px)']//span"))
If you just want the change:
=IMPORTXML("https://finance.yahoo.com/quote/IBM","//*[#class='Mt(6px)']//span[2]")
Sadly Yahoo Finance changes the XML/HTML structure of its website quite often. The one that works for now is:
=IMPORTXML("https://finance.yahoo.com/quote/IBM/", "//*[#id=""quote-header-info""]/div[3]/div[1]/div/span[1]")
You may always open the HTML structure and use the developer tools to find and copy the X-path.
P.S.1. Though there seem to be a bug and the function can't retrieve data from URLs where there is a dot/point/period "." in the name.
P.S.2. The IMPORTHTML() function can't also fetch the latest price from Yahoo Finance because the information is neither in a table nor a list. You can try the scripts from this page and this page to list all the tables and lists.

Write protect cell after first user entry in Google Spreadsheets or Microsoft Excel

How to write protect a cell once any user has written a value to it? Is there a formula? Here's what I'm trying to accomplish. Here's an empty monthly planned tests sheet on Google spreadsheets. About 60 teachers will have access to it. Their goal is to write in the name of their subject in a certain cell, which will mean they will carry a test on a certain day. Once a certain teacher writes the value, the cell needs to get closed from further edits by other teachers [first in, first out principle].
Some teachers would rewrite the values of their colleagues, some would do that by accident, etc. I would want the system to close the cell and even show a msg if that is possible to avoid rewrites or additions.
According to the law, we can have only 1 test per day in grades 1 to 7, and still some teachers would still try and write their subject when done on paper. Some would horrify me with their handwriting, which requires me to make phone calls, e-mails... So, I'm trying to make a digital transition.
Would appreciate any help. Scripting anyone?
For Google Spreadsheets, you have two options:
Hard way: create a custom script function that set cell permission. You attach the function to the sheet with installable trigger so that it will run under document owner permission.
Easy way: use Google Forms. You can create survey forms that function as the input interface. The editor can only submit new data but not view or edit existing data. You can set the spreadsheet permission to read-only if you want teachers to review data.

Resources