How to query openedx modulestore get_courses - openedx

I have tried to find the way already on the internet but unfortunately, I am not successful to find it.
I am trying to query openedx's modulestore to select courses with some criteria.
from xmodule.modulestore.django import modulestore
courses=modulestore().get_courses()
this how I am using it but now I want to apply some criteria to select courses.

Related

Using endsWith filter together with expanding user's memberOf doesn't work

I want to fetch all users together with their group names from MS Graph API.
It works as long as I don't want to do some advanced filtering (endsWith()).
Here's the select query I'm running:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)
It produces a nice set of users together with the display name's of groups they are in.
I wanted to restrict the result to a specific mail domain (i have added ConsistencyLevel: eventual), however I am unable to do it unless I remove the memberOf expand. This works:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$count=true&$filter=endsWith(mail,'#somedomain.com')
But as expected, there are no groups. In fact, there are no groups at all despite selecting memberOf! I thought I'll just fetch groups first and then pair them in my code, but to get them I must expand, and with expand the filter doesn't work!
This produces an Request_UnsupportedQuery error:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)&$count=true&$filter=endsWith(mail,'#somedomain.com')
Is there any way to achieve what I want without filtering manually or issuing multiple requests and mapping stuff on my own? We're talking about directories containing tens of thousands of users.. Graph seemed to be nice at the beginning but as I wanted to do anything more complex it turns out to be a limited POS where one query totally excludes another. I was also unable to filter by the expanded memberOf in any way
Based on Microsoft Docs
$expand is not currently supported with advanced queries.

visNetwork selectedBy (visOptions function) for multiple columns

I have written code for a visNetwork network. Within the visOptions function, it can currently select node by id (using nodesIdSelection) as well as select nodes using values from a particular column (using selectedBy). I have looked through the documentation to see how to select nodes using additional columns (i.e. multiple drop down lists in HTML) but can't find the syntax.
Any help would be much appreciated.
try to use the DataSet get method with your prefered options.
then you can select the returned array to select your nodes.

how can i search by name in CompanyCurrency table in Quickbooks online api

When i try to query this " Select Name from CompanyCurrency" i get this error
Error
And If i Query by Code i get a result like this (Select Code from CompanyCurrency):
Results by selecting the name
Well , i don't know why is this happening because both code and name are properties in the table , any way i wanted to skip this issue by searching on the code so i've did the search query using like operator and it faults even the same query on all the other tables on the quickbooks online works fine .
any one knows the issue that related with this table ?
I don't think you can filter the results of that query. Looking at the Manage multiple currencies docs like they do on other endpoints, it doesn't list any fields as filterable. You should retrieve the list and just select the one you need in your code.

Umbraco Audit Trail Report

Does anyone know if there is a package available for Umbraco 7 which will produce a report listing content changes that have been made in a specified date range?
I would like to be able to specify a date range and have a list of all content changes. Ideally I would like to have the date, time, user and content before and after the publish.
Does anyone know if this is possible?
I stumbled across this post and thought you might like to know I've written such a package (for Umbraco 7.4 > ). You can filter by date range, log type and other parameters.
https://our.umbraco.org/projects/developer-tools/diplo-audit-log-viewer/
I don't think there is any package related to audit trail.
However, it should not be too hard to achieve what you want by querying the database.
First of, according to your description, you would need to join three table
umbracoLog - this is where audit trail information is stored
umbracoUser - to get the name who perform the action
umbracoNode - to get the node information which got action perform
So a sql could be:
SELECT TOP 1000 [umbracoLog].[id]
,[userId]
, userName
,[NodeId]
, umbracoNode.text
,[Datestamp]
,[logHeader]
,[logComment]
FROM [molweb2].[dbo].[umbracoLog]
inner join umbracoUser on userId = umbracoUser.id
inner join umbracoNode on NodeId = umbracoNode.id
Then base on what you need to filter, just add the relevant where condition.
For Example,
Show only between 2015/11/02 to 2016/01/12:
where Datestamp > '20151102' and Datestamp < '20160112'
Be careful, the current sql does not filter out non content audit trail.

How could I write this queries in neo4j?

I'm very new to neo4j and to graph database in general. I'm prototyping an app, and I don't know how should i write these queries
I've this domain:
User
Restaurant
Review
TypeOfFood
So a Restarurant have one or many TypeOfFood, the User leaves reviews about restaurants. The User have some preferred foods, matching the TypeOfFood a restaurant sell. Also Users are related to each other with the typically friend relationship.
Some of the queries I'm trying to write:
Give me all the restaurants that my friends have rated with 3 or more stars that make the kind of food I like (exclude those restaurants that I already reviewed)
Suggest me friends I may know (I guess this should be something like "all the friends that are friends of my friends but no yet mine, order by something)
Using Neo4j's Cypher query language you could write your queries like this:
Selecting the top-20 best rated restaurants, sorted by stars and number of reviews
start user=(users,name,'Nico')
match user-[:FRIEND]->friend-[r,:RATED]->restaurant-[:SERVES]->food,
user-[:LIKES]->food,user-[:RATED]->rated_by_me
where r.stars > 3
return restaurant.name, avg(r.stars), count(*)
order by avg(r.stars) desc, count(*) desc
limit 20
Friends of a Friend
start user=(users,name,'Nico')
match user-[:FRIEND]->friend->[:FRIEND]->foaf
return foaf, foaf.name
You can execute these cypher queries in the Neo4j Webadmin Console on your dataset, but also in the neo4j-shell, remotely via the Cypher-Rest-Plugin via Spring Data Graph.
There is also a screencast discussing similar queries in cypher.
You can also use Gremlin, Neo4j-Traversers or manual traversing via getRelationships if you'd like.

Resources