Coder Social home page Coder Social logo

shiftsharp's People

Contributors

point85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

shiftsharp's Issues

PrintShiftInstances exception - end.earlier.than.start

Hello,
I would like to thank you for this awesome library first.

I tried to analyze why my schedule settings not working as I expected.
I need two twelve hours shifts - day & night, four teams 24/7 (see picture)
image

I configured my schedule like this:
` _workSchedule = new WorkSchedule(scheduleName, description);

        // Day shift, starts at 06:00 for 12 hours
        Shift day = _workSchedule.CreateShift("Day", "Day shift", new LocalTime(6, 0, 0), Duration.FromHours(12));

        // Night shift, starts at 18:00 for 12 hours
        Shift night = _workSchedule.CreateShift("Night", "Night shift", new LocalTime(18, 0, 0), Duration.FromHours(12));

        // rotation
        Rotation rotation = _workSchedule.CreateRotation("My rotation",
                "description..");

        rotation.AddSegment(day, 2, 2);
        rotation.AddSegment(night, 3, 2);
        rotation.AddSegment(day, 2, 3);
        rotation.AddSegment(night, 2, 2);
        rotation.AddSegment(day, 3, 2);
        rotation.AddSegment(night, 2, 3);

        // reference date for start of shift rotations
        LocalDate referenceDate = new LocalDate(2019, 1, 7);

        _workSchedule.CreateTeam("Blue", "First team", rotation, referenceDate);
        _workSchedule.CreateTeam("Yellow", "Second team", rotation, referenceDate.PlusDays(14));
        _workSchedule.CreateTeam("Red", "Third team", rotation, referenceDate.PlusDays(21));
        _workSchedule.CreateTeam("Green", "Fourth team", rotation, referenceDate.PlusDays(7));`

Problem was when I tried 04.02.2019 1:55 - I expected that output will be Red team..But result was Blue team.. So I wanted to analyse reason. I tried to use _workSchedule.PrintShiftInstances() , but exception was returned (ex. key = end.earlier.than.start). Reason for this exception was that start.CompareTo() returned -1
if (start.CompareTo(end) < 0) { string msg = String.Format(WorkSchedule.GetMessage("end.earlier.than.start"), start, end); throw new Exception(msg); }
I used this variables as parameters for compareTo method:
LocalDate start = new LocalDate(2019, 1, 9); LocalDate end = new LocalDate(2019, 2, 28);

I also check unit testing project but testToString is disabled (I tried TestDupont)
testToString = false;

Could you help me what's wrong please?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.