Getting issue with heremap multiple pickup and multiple drop api - reactjs

I am using multiple pickup api with prams as suggested by heremap docs:
https://fleet.ls.hereapi.com/2/findpickups.json?mode=fastest;truck;traffic:disabled&start=waypoint0;50.115620,8.631210;pickup:GRAPEFRUIS,value:1000&departure=2020-11-14T07:30:00&driverCost=20&restTimes=disabled&end=waypoint7;50.132540,8.649280;drop:GRAPEFRUITS,value:1000&destination0=waypoint1;50.118578,8.636551;drop:APPLES,value:30&destination1=waypoint2;50.122540,8.631070;pickup:BANANAS&destination2=waypoint3;50.128920,8.629830;drop:BANANAS,value:30&destination3=waypoint4;50.118654,8.619956;pickup:APPLES&destination4=waypoint5;50.123998,8.640626;drop:PEACHES,value:50&destination5=waypoint6;50.130299,8.613031;pickup:PEACHES&apiKey={key}
drop for GRAPEFRUIT is defined but getting error message: No drop-off point defined for payload GRAPEFRUIS,value:1000

There are several issues with your url:
There is a typo (GRAPEFRUIS)
pickup doesn't have a value field (see https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/api-reference-type-waypoint.html)
"pickup only allowed at optional way points"
So if you change
start=waypoint0;50.115620,8.631210;pickup:GRAPEFRUIS,value:1000
to
start=waypoint0;50.115620,8.631210
and
end=waypoint7;50.132540,8.649280;drop:GRAPEFRUITS,value:1000
to
end=waypoint7;50.132540,8.649280
then this url will work:
https://fleet.ls.hereapi.com/2/findpickups.json?mode=fastest;truck;traffic:disabled&start=waypoint0;50.115620,8.631210&departure=2020-11-14T07:30:00&driverCost=20&restTimes=disabled&end=waypoint7;50.132540,8.649280&destination0=waypoint1;50.118578,8.636551;drop:APPLES,value:30&destination1=waypoint2;50.122540,8.631070;pickup:BANANAS&destination2=waypoint3;50.128920,8.629830;drop:BANANAS,value:30&destination3=waypoint4;50.118654,8.619956;pickup:APPLES&destination4=waypoint5;50.123998,8.640626;drop:PEACHES,value:50&destination5=waypoint6;50.130299,8.613031;pickup:PEACHES&apiKey={key}

Related

How i can resolve conflict type AcfLink

I have a problem with Gatsby, I have a type conflict in Link relation in WordPress
Fields "button" conflict because they return conflicting types AcfLink and String. Use different aliases on the fields to fetch both if this was intentional.
Error path: undefined
in query request
button {
url
title
}
How do I resolve this conflict
You can alias both fields with:
button {
newName1: url
newName2: title
}
After that, you will need to refer to each field using button.newName1 and button.newName2 respectively.
GraphQL aliases docs: https://graphql.org/learn/queries/#aliases

Apollo Client readFragment with custom id (keyFields)

For ref, using "#apollo/client": "^3.5.5",
I've defined my typePolicies like so as suggested in docs:
HistoricalData: {
keyFields: ["variable", "workspace"],
fields:{...}
}
and when my cache is built, I am expecting my cacheId to be like
<__typename>:<id>:<id>
HistoricalData:${props.variable}:${props.workspace}`;
but instead, when I look in the Apollo cache, it's been created using the keyField names and the values in an object, such as
HistoricalData:{"variable":"GAS.TOTAL","workspace":"ABC"}
instead of
HistoricalData:GAS.TOTAL:ABC
so when I try to readFragment it returns null
client.readFragment({
id: `HistoricalData:${props.variable}:${props.workspace}`,
fragment: apolloGQL`fragment MyHistorical on Historical {
variable
workspace
}`})
It does actually return a value from the cache if I create my id in the structure that exists in the cache and readFragment using this.
Has anyone else noticed that Apollo client is not creating the cache id's in the structure that they describe in the docs?
After some research I came upon the correct way to handle this case. I know that you have already moved on, but just in case anyone else has the same problem in the future, here goes:
As described in the documentation for customizing the cache ID, the cache ID will be an stringified object, as you pointed out. It's not quite explicit in the documentation, but at this point in time it provides this nested example for a cache ID:
Book:{"title":"Fahrenheit 451","author":{"name":"Ray Bradbury"}}
But as users we don't have to preoccupy us with the format of this ID, because there's a helper for that, called cache.identify.
For your specific case, you could use something like this:
const identifiedId = cache.identify({
__typename: 'HistoricalData',
variable: 'GAS.TOTAL',
workspace: 'ABC'
});
cache.readFragment({
id: identifiedId,
fragment: apolloGQL`fragment MyHistorical on Historical {
variable
workspace
}`
});

Query based on multiple filters in Firebase

I am working out the structure for a JSON database for an app like onlyFans. Basically, someone can create a club, then inside of that club, there are sections where the creator's posts are shown and another where the club members posts are shown. There is however a filter option where both can be seen.
In order to make option 1 below work, I need to be able to filter based on if isFromCreator=true and at the same time based on timstamp. How can I do this?
Here are the 2 I have written down:
ClubContent
CreatorID
clubID
postID: {isFromCreator: Bool}
OR
creatorPosts
postID: {}
MemeberPosts
postID: {}
Something like the below would be what I want:
ref.child("Content").child("jhTFin5npXeOv2fdwHBrTxTdWIi2").child("1622325513718")
.queryOrdered(byChild: "timestamp")
.queryLimited(toLast: 10)
.queryEqual(toValue: true, childKey: "isFromCreator")
I triedqueryEqual yet it did not return any of the values I know exist with the configuration I specified.
You can use additional resource locations within rules by referencing the parent/child directories specifically and comparing the val() of the respective node structure.
for example:
".write": "data.parent().child('postID').child('isFromCreator').val()"
Just be aware that Security Rules do not filter or process the data in the request, only allow or deny the requested operation.
You can read more about this from the relevant documentation:
https://firebase.google.com/docs/database/security/rules-conditions#referencing_data_in_other_paths
https://firebase.google.com/docs/database/security/core-syntax#rules-not-filters

change event not getting triggered with poltergeist

I have 2 dropdowns and on change of first am prepopulating the second dropdown(which is been done in backbone).
events: ->
'change #client_id': 'selectedClientChange'
selectedClientChange: (ev) ->
#populateGroups $(ev.target.selectedOptions).val()
Written capybara specs for the same with poltergeist but change event is not getting triggered for some reason and spec is getting failed.
scenario 'it should populate the groups automatically', js: true, speed: :slow do
click_link 'New Item'
find('#name').set('Sample Item')
page.execute_script("$('#client_id').val('testing').trigger('change')")
select "#{client.name}", from: "client_id"
groups = find('#group_id').all('option').collect(&:text)
expect(groups.count).to eq 1
expect(groups).to include pg.name
end
Can someone tell me how to solve this.
Without details about the error you're getting this is mostly a guess - It's possible you're getting the groups before the change event from the select actually updates them. You'd be better off using the have_select matcher since it will retry for a time to see if the field changes to match the requirements
select "#{client.name}", from: "client_id"
expect(page).to have_select('group_id', options: [pg.name])
Ah sorry everyone. I see that there is an issue with poltergeist which I found here https://github.com/teampoltergeist/poltergeist/issues/204. Thanks alot!

extjs store fail

ExtJS Model fields have mapping option.
fields: [
{name: 'brandId', mapping:'brand.id', type: 'int'},
{name: 'brandName', mapping:'brand.name', type: 'string'},
The problem is: if the response from server does not contain some field(brand field in my example) and mapping from inner fields is defined, Ext Store silently fails to load any records.
Does anybody have problems with this? Is it some kind of a bug?
UPDATE
To make it clear: suppose I have ten fields in my model. Response from server has nine fields, one is missing. If there is no nested mapping for this field (mapping:'x.y.z') everything is OK - store loads record, the field is empty. But if this field has to be loaded from some nested field and has mapping option - store fails to load ANYTHING.
UPDATE 2
I have found the code, that causes problems. The fact is: when Ext tries to load some field from Json it performs a check like this
(source["id"] === undefined) ? __field0.defaultValue : source["id"]
But when field has mapping option(mapping 'brand.id') Reader does it this way
(source.brand.id === undefined) ? __field20.defaultValue : source.brand.id
which causes error if source has no brand field.
In case you have same problems as I: you can fix it by overloading Ext.data.reader.Json's method createFieldAccessExpression
I agree that Ext should only fail to load that field, not the entire record. One option that isn't great, but should work, is instead use a mapping function:
{
name: 'brandId',
mapping: function(data, record) {
return data.brand && data.brand.id;
}
}
I could have the arguments wrong (I figured out that this feature existed by looking at the source code), so maybe put a breakpoint in there to see what's available if it doesn't work like this.
I think you're misinterpret mapping and nesting paradigms: these are not interchangeable.
If you define nesting in your data, the result MUST have the corresponding field.

Resources