D2L Valence: Retrieve Final Grades - desire2learn

Is there a way to get both the Final Calculated Grade and the Final Adjusted Grade? I would like to be able to compare them.

I'm wondering:
GET /d2l/api/le/(version)/(orgUnitId)/grades/values/(userId)/
Retrieve all the grade objects for a particular user assigned in an org unit.
Return. This action returns a JSON array of GradeValue blocks.
Grade.GradeValue{
"DisplayedGrade": <string>,
"GradeObjectIdentifier": <string:D2LID>,
"GradeObjectName": <string>,
"GradeObjectType": <number:GRADEOBJ_T>,
"GradeObjectTypeName": <string>|null,
"PointsNumerator": <number>|null,
"PointsDenominator": <number>|null,
"WeightedDenominator": <number>|null,
"WeightedNumerator": <number>|null
}
and then look at the "GradeObjectType" for "7" or "8"?
Grade object type / Value
FinalCalculated / 7 ^
FinalAdjusted / 8 ^
(I wonder what is meant by "^ Direct creation of these types through these APIs is not supported.")

It seems the best solution (or workaround) is to retrieve the final grade, determine what column it's coming from, and then subtract or add (+1 / -1) to the objectID to get the corresponding Calculated or Adjusted column.

I believe that there currently is no way to retrieve the final adjusted grade value through the Valence Learning Framework API, only the final calculated grade value. Additionally, end-user type callers can only see the final grade when the grade gets released: up until that point, only users capable of setting a final grade value (or perhaps releasing it?) can see the final grade value for a user.

Related

Ruby on rails how to take lowest/biggest number from array

I have an array with products, I need to display only 1 product, with the largest number in available_amount. How can i do this?
How do I iterate to display products with parameters:
- #part.wh_ps.sort_by(&:available_amount).each do |whp|
product number1: available_amount: 2;
product number2: available_amount: 5;
If those objects are mapped from the database being the result of a query and you already have them in memory, then you could use Enumerable#max_by:
#part.wh_ps.max_by(&:available_amount)
It should return the object within that array with the biggest available_amount if any.
If you need the one with the lowest available_amount, then Enumerable#min_by, and if you need both Enumerable#minmax_by.
However if that's not the case and you're hitting the database again, you could consider making the exact query using SQL (ActiveRecord) asking for the row with the biggest value for the given column.

core data derivation expression key path uses an operator as an intermediate component

I'm trying to write the derivation expression for the sum of a to many relationship attribute.
I have an item and a group, the item has a price and total price (amount * price).
I want to write an expression for the total price for the group as the sum of its components.
When I build I get the error
error: Misconfigured Property: LAEItemGroup.totalPrice key path
“items.#sum.totalPrice” uses an operator as an intermediate
component
according to the documentation and the WWDC 2019 Making Apps with Core Data it should be possible to get the sum on a to many relationship.
Could someone please help me find the correct syntax or way to do so.
As a work around I tried to write a var that worked in that class as so
#objc
public var totalPrice: Double {
value(forKeyPath: "items.#sum.totalPrice") as? Double ?? 0
}
so why the KeyPath value works but not in the model editor?
I just finished a WWDC Core Data lab with Rishi who helped me with this! You should use sum:(items.totalPrice) instead of the .#sum syntax. The parentheses syntax can also be used for some other functions (e.g. count:(items) (the number of items in the to-many relationship) or max:(items.createdAt) (the date of the most recent item)).
I've now had an opportunity to check. It seems the format used by the model editor is for the aggregate operator to be at the end of the expression (which as you point out, is different from the format used in other expressions):
items.totalPrice.#sum
Use items.totalPrice.#sum as the derived property's expression in Xcode's model editor.
This only looks to work for numeric types though? I have a property maxDate with a derived property expression of
items.createdAt.#max
It compiles but throws an error at runtime:
'NSInvalidArgumentException', reason: 'currently unsupported (too many steps)
Where Date is the data type for createdAt

SSRS: Adding a filter that returns information from entire group

I am trying to create a report in SSRS. Below is a small example of what my dataset looks like.
Example Data Set
So, there are three different stores (A,B,C) and each has a landlord (a,b,c). Landlords can pay via three different methods (1,2,3) and the amounts paid per method are shown.
Right now, I have two filters set up. The first is by Store and the second is by Landlord.
What I am having trouble with is:
How can I set up a filter by the Amount that will return information from an entire Store/Landlord?
So for example, if I wanted to filter Amount by 150, I would like to return all the "payment" information for the store(s) that have a payment of 150. Such as the following:
Desired Result
Is it possible to add a filter to return information from the entire group? (Store and Landlord are the group in this case)
I am new to SSRS so any help/insight would be greatly appreciated!
You can use LookUpSet to locate the matching groups, JOIN to put the results in a string and the INSTR function to filter your results.
=IIF(ISNOTHING(Parameters!AMOUNT.Value) OR INSTR(
Join(LOOKUPSET(Fields!Amount.Value, Fields!Amount.Value, Fields!Store.Value, "DataSet1"), ", ") ,
Fields!Store.Value
) > 0, 1, 0)
This translates to:
If the Store value is found (INSTR > 0) in the list (JOIN) of Stores where the Amount is the current Amount (Lookupset).
In your filter, put the above expression in the Expression, change the type to INTEGER and the Value to 1.
[

Filtering by aggregate function

I am trying to raise an event when the average value of a field is over a threshold for a minute. I have the object defined as:
class Heartbeat
{
public string Name;
public int Heartbeat;
}
My condition is defined as
select avg(Heartbeat) , Name
from Heartbeat.std:groupwin(Name).win:time(60 sec)
having avg(Heartbeat) > 100
However, the event never gets fired despite the fact that I fire a number of events with the Heartbeat value over 100. Any suggestions on what I have done wrong?
Thanks in advance
It confuses many people, but since time is the same for all groups you can simplify the query and remove the groupwin. The documentation note in this section explains why: http://esper.codehaus.org/esper-4.11.0/doc/reference/en-US/html_single/index.html#view-std-groupwin
The semantics with or without groupwin are the same.
I think you want group-by (and not groupwin) since group-by controls the aggregation level and groupwin controls the data window level.
New query:
select avg(Heartbeat) , Name from Heartbeat.win:time(60 sec) group by Name having avg(Heartbeat) > 100

Sybase compare columns with duplicate row ids

So far I have a query with a result set (in a temp table) with several columns but I am only concerned with four. One is a customer ID(varchar), one is Date (smalldatetime), one is Amount(money) and the last is Type(char). I have multiple rows with the same custmer ID and want to evaluate them based on Date, Amount and Type. For example:
Customer ID Date Amount Type
A 1-1-10 200 blue
A 1-1-10 400 green
A 1-2-10 400 green
B 1-11-10 100 blue
B 1-11-10 100 red
For all occurrences of A I want to compare them to identify only one, first by earliest date, then by greatest Amount, then if still tied by comparing Types. I would then return one row for each customer.
I would provide some of the query but I am at home now after spending two days trying to get a correct result. It looks something like this:
(query to populate #tempTable)
GROUP BY customer_id
HAVING date_cd =
(SELECT MIN(date_cd)
FROM order_table ot
WHERE ot.customerID = #tempTable.customerID
)
OR date_cd IS NULL
I assume the HAVING would result in only one row per customer_id. This did not end up being the case since there were some ties there.
I am not sure I can do the OR - there are some with NULL values here - and it did not account for the step to the next comparison if they were all the same anyway. I am not seeing a way to avoid doing some row processing of the temp table with some kind of IF or WHERE loop.
As I write I am thinking maybe I use #tempTable.date_cd in the HAVING clause instead of looking at the original table. but that should return the same dates?
Am I on the right track or is there something missing? Suggestions? More info??
try below query :-
select * from #tempTable
GROUP BY customer_id
HAVING isnull(date_cd,"1900/01/01") =min(isnull(date_cd,"1900/01/01"))

Resources