@startuml 'skinparam backgroundColor #AAFFFF skinparam activity { 'StartColor red 'BarColor SaddleBrown 'EndColor Silver 'BackgroundColor Peru BackgroundColor<> Orange 'BorderColor Peru 'FontName Impact } title **Current (2017) scheduling activity diagram (general overview)** (*) --> "schedule = (Schedule Creation)" --> "Set night limits (schedule.plan_start and schedule.plan_end)" --> if "First Schedule ?" then -->[yes] "schedule.plan_night_start = schedule.plan_start" --> "Setting of sequences : a list of all the observable sequences (from database)" as A2 else -->[no] "Recovery of previous schedule's data: EXECUTED sequences, plan_night_start, plan_end copy_from_previous_schedule()\l" <> endif --> A2 --> "//Add to each sequence its schedule id:// sequences = [(sequence, shs) for sequence in sequences]" --> "Creation of the interval [plan_start ; plan_end] \land insertion in the intervals list" --> "Remove invalid sequences bad parameters : jd1 < 0 for example removeInvalidSequences()"<> --> "// TODO: Determine priorities according to user and SP"<> -->"Remove non eligible sequences //remove UNPLANNABLE sequences : overlap [jd1; jd2], [plan_start; plan_end] < duration for example// removeNonEligibleSequences()" <> --> "Sort Sequences //Sort sequences by priority and soonest jd2// sortSequences()"<> --> "Check Quota //Check if the user's quota is sufficient//" -->if "Is Quota Sufficient ?" then -->[no] "Reject Sequence" else -->[yes]"Get matching intervals //Get the matching intervals for the sequence//" endif -->if "Intervals Found ?" then -->[yes] "Place sequence placeSequence(sequence, shs, matching)" <> --> ==P== else -->[no] "Try Shifting Sequences //Trying to shift the left or/and right sequences// //in order to fit the current sequence//" <> endif --> ==P== --> if "Sequence PLACED ?" then -->[yes] "Decrease quota()" <> -->"Save Schedule //set the sequence status to PLANNED// //and save the new schedule// saveSchedule()"<> else -->[no] "Reject Sequence" endif @enduml