Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharepoint synchronization functionality #763

Merged
merged 16 commits into from
Feb 13, 2020

Conversation

ShilovSS
Copy link

No description provided.

@ShilovSS ShilovSS requested a review from santee December 12, 2019 12:31
public class SickLeaveModelConverter
{
public Expression<Func<CSP.Model.SickLeave, SickLeaveDescription>> ToDescription { get; }
= model => new SickLeaveDescription()
{
SickLeaveId = model.Id,
EmployeeId = new EmployeeId(model.EmployeeId),
StartDate = model.Start,
EndDate = model.End,
Status = model.SickLeaveCancellations.Any() ? SickLeaveStatus.Cancelled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santee, are you sure the logic is correct? In Akka version it was a bit different.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In previous version we used timestamp of each sick leave status change to determine the most actual status:

        private CalendarEventWithAdditionalData CreateCalendarEventFromSickLeave(SickLeaves sickLeave)
        {
            var completed = sickLeave.SickLeaveCompletes
                .Select(c => new CalendarEventWithAdditionalData.SickLeaveCompletion(c.ById.ToString(), c.At))
                .FirstOrDefault();

            var cancelled = sickLeave.SickLeaveCancellations
                .Select(c => new CalendarEventWithAdditionalData.SickLeaveCancellation(c.ById.ToString(), c.At))
                .FirstOrDefault();

            var statuses = new[]
            {
                Tuple.Create(completed?.Timestamp, SickLeaveStatuses.Completed),
                Tuple.Create(cancelled?.Timestamp, SickLeaveStatuses.Cancelled)
            };

            var status = statuses
                .Where(x => x.Item1 != null)
                .OrderByDescending(x => x.Item1)
                .FirstOrDefault()
                ?.Item2;
            status = status ?? SickLeaveStatuses.Requested;

            var calendarEvent = new CalendarEvent(
                this.calendarEventIdParser.GetCalendarEventIdFromCspId(sickLeave.Id, CalendarEventTypes.Sickleave),
                CalendarEventTypes.Sickleave,
                new DatesPeriod(sickLeave.Start.Date, sickLeave.End.Date),
                status,
                sickLeave.EmployeeId.ToString());

            return new CalendarEventWithAdditionalData(calendarEvent, cancelled, completed);
        }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@santee? You haven't answered yet :)

sergey.shilov added 5 commits December 25, 2019 14:41
# Conflicts:
#	server2/Arcadia.Assistant/Arcadia.Assistant.SF/ApplicationPackageRoot/ApplicationManifest.xml
#	server2/Arcadia.Assistant/Arcadia.Assistant.SF/PublishProfiles/Azure.xml
#	server2/Arcadia.Assistant/Arcadia.Assistant.sln
@ShilovSS ShilovSS merged commit 2deab3a into feature/no-akka Feb 13, 2020
@sponkrashin sponkrashin deleted the feature/sharepoint_synchronization branch February 13, 2020 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants