transforms are not applied
See original GitHub issueHi, I’m aware of this package still is in preview and sorry to file an issue. I am not sure you’ve worked on this or not or you have any plan to support this, if you share your plan it helps a lot for me to plan my next set of actions.
Being said, I have a case that filters and aggregates are not applied.
URL:
http://localhost:5000/odata/graphMyAssignedActivities?$apply=filter(isLate eq true)/groupby((statusInfo/DisplayName,statusInfo/Color),aggregate(id with count distinct as activitiesCount))
My Current Usage that this query works:
[HttpGet]
[EnableQuery(MaxExpansionDepth = 8)]
public async Task<ActionResult<IQueryable<GraphActivityDto>>> Get([FromQuery] GraphFilter filter) {
var activities = await _activityService.GetQueryableActivitiesByScope();
var projected = activities.ProjectTo<GraphActivityDto>(_mapper.ConfigurationProvider);
if (Request.Query.ContainsKey("$apply")) { //it's because of an issue in EFCore 3.0
projected = projected.ToLinqToDB();
}
return Ok(projected);
}
Updated usage:
[HttpGet]
//[EnableQuery(MaxExpansionDepth = 8)]
public async Task<ActionResult<IQueryable<GraphActivityDto>>> Get(ODataQueryOptions<GraphActivityDto> OdataQueryOptions) {
var activities = await _activityService.GetQueryableActivitiesByScope();
var result = await activities.GetQueryAsync(_mapper, OdataQueryOptions, HandleNullPropagationOption.True);
return Ok(result);
}
and this is generated Expression
EntityQueryable<Activity>.Select(
dtoActivity => new GraphActivityDto
{
ActivityName = dtoActivity.ActivityName,
ActivityStandard = (dtoActivity.ActivityStandard == null)
? null
: new ActivityStandardBasicDto
{
ActivityType = dtoActivity.ActivityStandard.ActivityType,
Id = dtoActivity.ActivityStandard.Id,
Name = dtoActivity.ActivityStandard.Name
},
ActivityType = dtoActivity.ActivityStandard.ActivityType,
ActualEndDate = dtoActivity.ActualEndDate,
ActualStartDate = dtoActivity.ActualStartDate,
Id = dtoActivity.Id,
IsLate = (dtoActivity.PlannedStartDate.HasValue && !dtoActivity.ActualStartDate.HasValue)
? ((DateTimeOffset?)DateTimeOffset.Now.ToUniversalTime().AddDays(-1d)) > dtoActivity.PlannedStartDate
: (dtoActivity.PlannedEndDate.HasValue && !dtoActivity.ActualEndDate.HasValue) && (((DateTimeOffset?)DateTimeOffset.Now.ToUniversalTime().AddDays(-1d)) > dtoActivity.PlannedEndDate),
IsPromoting = dtoActivity.IsPromoting,
PlannedEndDate = dtoActivity.PlannedEndDate,
PlannedStartDate = dtoActivity.PlannedStartDate,
ProjectId = dtoActivity.Project.Id,
ProjectName = dtoActivity.Project.Name,
ProjectPhaseId = dtoActivity.ProjectPhaseId,
Roles = dtoActivity.Roles.Select(
dtoActivityRoleAssignment => new ProjectRoleGraphDto
{
Id = dtoActivityRoleAssignment.Role.Id,
Name = dtoActivityRoleAssignment.Role.UserGroup.Name,
Users = dtoActivityRoleAssignment.Role.ProjectUsersRolesAssignments.Select(t => t.ProjectUser).Select(
dtoProjectUser => new ProjectUserGraphDto
{
Email = dtoProjectUser.User.Email,
Id = dtoProjectUser.User.Id,
Image = FileResolverExtension.Resolve(dtoProjectUser.User.Picture),
Name = dtoProjectUser.User.FullName
})
}),
StatusInfo = (dtoActivity.Status == null)
? null
: new ActivityStatusDto
{
Abbreviation = dtoActivity.Status.Abbreviation,
Color = dtoActivity.Status.Color,
DisplayName = dtoActivity.Status.DisplayName,
Editable = dtoActivity.Status.Editable,
Id = dtoActivity.Status.Id,
Name = dtoActivity.Status.Name,
Order = dtoActivity.Status.Order
},
StatusSteps = dtoActivity.StatusSteps.Select(
dtoActivityStatusStep => new ActivityApprovalGraphDto
{
ActivityId = dtoActivityStatusStep.ActivityId,
ActivityStatusId = dtoActivityStatusStep.ActivityStatusId,
ApprovalStep = (dtoActivityStatusStep.ApprovalStep == null)
? null
: new ApprovalStepDto
{
Color = dtoActivityStatusStep.ApprovalStep.Color,
Done = dtoActivityStatusStep.ApprovalStep.Done,
Id = dtoActivityStatusStep.ApprovalStep.Id,
Name = dtoActivityStatusStep.ApprovalStep.Name,
Order = dtoActivityStatusStep.ApprovalStep.Order,
Role = dtoActivityStatusStep.ApprovalStep.Role,
Todo = dtoActivityStatusStep.ApprovalStep.Todo
},
ApprovalStepId = dtoActivityStatusStep.ApprovalStepId,
Id = dtoActivityStatusStep.Id,
IsCurrentStatus = ((!dtoActivityStatusStep.ProjectUsersAssignments.Any() && !dtoActivityStatusStep.RoleAssignments.Any()) || dtoActivityStatusStep.RoleAssignments.Any(
ro => !ro.ProjectRole.ProjectUsersRolesAssignments.Any(
usr => dtoActivityStatusStep.Votes.Any(v => (v.ProjectUserId == usr.ProjectUserId) && (((int)v.Status) == 2))))) || (dtoActivityStatusStep.ProjectUsersAssignments.Any(
usr => !dtoActivityStatusStep.Votes.Any(v => (v.ProjectUserId == usr.ProjectUserId) && (((int)v.Status) == 2))) && (dtoActivityStatusStep.Activity.ActivityStatusId == dtoActivityStatusStep.ActivityStatusId)),
RequestedAt = dtoActivityStatusStep.ProjectUsersAssignments.Any()
? dtoActivityStatusStep.ProjectUsersAssignments.First().RequestedAt
: dtoActivityStatusStep.RoleAssignments.Any()
? dtoActivityStatusStep.RoleAssignments.First().RequestedAt
: null,
Roles = dtoActivityStatusStep.RoleAssignments.Select(
dtoActivityStatusStepRoleAssignment => new ProjectRoleGraphDto
{
Id = dtoActivityStatusStepRoleAssignment.ProjectRole.Id,
Name = dtoActivityStatusStepRoleAssignment.ProjectRole.UserGroup.Name,
Users = dtoActivityStatusStepRoleAssignment.ProjectRole.ProjectUsersRolesAssignments.Select(t => t.ProjectUser).Select(
dtoProjectUser => new ProjectUserGraphDto
{
Email = dtoProjectUser.User.Email,
Id = dtoProjectUser.User.Id,
Image = FileResolverExtension.Resolve(dtoProjectUser.User.Picture),
Name = dtoProjectUser.User.FullName
})
}),
Users = dtoActivityStatusStep.ProjectUsersAssignments.Select(t => t.ProjectUser).Select(
dtoProjectUser => new ProjectUserGraphDto
{
Email = dtoProjectUser.User.Email,
Id = dtoProjectUser.User.Id,
Image = FileResolverExtension.Resolve(dtoProjectUser.User.Picture),
Name = dtoProjectUser.User.FullName
}),
Votes = dtoActivityStatusStep.Votes.Select(
dtoActivityStatusStepVote => new ActivityStatusStepVoteGraphDto
{
ActivityStatusStepId = dtoActivityStatusStepVote.ActivityStatusStepId,
Justification = dtoActivityStatusStepVote.Justification,
ProjectUserId = dtoActivityStatusStepVote.ProjectUserId,
RespondedAt = dtoActivityStatusStepVote.RespondedAt,
Status = dtoActivityStatusStepVote.Status,
User = (dtoActivityStatusStepVote.ProjectUser == null)
? null
: new ProjectUserGraphDto
{
Email = dtoActivityStatusStepVote.ProjectUser.User.Email,
Id = dtoActivityStatusStepVote.ProjectUser.User.Id,
Image = FileResolverExtension.Resolve(dtoActivityStatusStepVote.ProjectUser.User.Picture),
Name = dtoActivityStatusStepVote.ProjectUser.User.FullName
}
})
}),
Users = dtoActivity.Users.Select(u => u.ProjectUser).Select(
dtoProjectUser => new ProjectUserGraphDto
{
Email = dtoProjectUser.User.Email,
Id = dtoProjectUser.User.Id,
Image = FileResolverExtension.Resolve(dtoProjectUser.User.Picture),
Name = dtoProjectUser.User.FullName
})
})
as you can see, no group by or count distinct is added
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
CSS3 transform not working
I know IE doesn't support this CSS3 property so that's not a problem. I used following CSS: li a { -webkit-transform:rotate(10deg); -moz- ...
Read more >Language transforms not applied when installing Acrobat ...
Problem: Language transform file used to configure Acrobat install via command line is not applied, and throws an error. When you use the ......
Read more >modeling - Apply all transformation issue
Two pots on the left has a strange behaviour when applying transformation, they rotate and the origin point moves up from the world...
Read more >DataLoader transformations not working
I have this code where I tested Normalize and LinearTranformation. torchvision.transforms.Normalize and torchvision.transforms.
Read more >Is CSS Transform Dead?
In this article I will be breaking down how each of these three properties work (it is not quite as simple as you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PRs are welcome.
This is it. The library gets its data from
OdataQueryOptions
and builds expressions from that data. Take OrderBy as an example.ok to ask questions here.