Пример #1
0
    def get_weekview_slots(self, weekdates):
        '''
        calculate available slots for weekdates (list of QDates)
        '''
        today = QtCore.QDate.currentDate()
        startday = today if today in weekdates else weekdates[0]  # monday
        sunday = weekdates[6]  # sunday

        # check for suitable apts in the selected WEEK!
        all_slots = appointments.future_slots(
            startday.toPyDate(),
            sunday.toPyDate(),
            self.appt1_clinicians,
            busy_serialno=self.serialno,
            override_emergencies=self.ignore_emergency_spaces)

        if self.app1_is_scheduled:
            self.set_primary_slots([])
        else:
            self.set_primary_slots(
                appointments.getLengthySlots(all_slots, self.app1_length))

        app2_slots = []
        if self.is_searching_for_double_appointments and \
                not self.app2_is_scheduled:
            all_slots = appointments.future_slots(
                startday.toPyDate(),
                sunday.toPyDate(),
                self.appt2_clinicians,
                busy_serialno=self.serialno,
                override_emergencies=self.ignore_emergency_spaces)
            self.set_secondary_slots(
                appointments.getLengthySlots(all_slots,
                                             self.app2_length)
            )
            app1_slots = set([])
            if self.app1_is_scheduled:
                iterset = [self.appointment_model.currentAppt.to_freeslot()]
            else:
                iterset = self.primary_slots
            for app1_slot in iterset:
                for app2_slot in self.secondary_slots:
                    wait = app1_slot.wait_time(self.app1_length,
                                               self.app2_length,
                                               app2_slot)
                    if wait is not None and wait <= MAX_WAIT:
                        app2_slots.append(app2_slot)
                        app1_slots.add(app1_slot)
            if not self.app1_is_scheduled:
                self.set_primary_slots(app1_slots)

        self.set_secondary_slots(app2_slots)
Пример #2
0
    def get_weekview_slots(self, weekdates):
        '''
        calculate available slots for weekdates (list of QDates)
        '''
        today = QtCore.QDate.currentDate()
        startday = today if today in weekdates else weekdates[0]  # monday
        sunday = weekdates[6]  # sunday

        # check for suitable apts in the selected WEEK!
        all_slots = appointments.future_slots(
            startday.toPyDate(),
            sunday.toPyDate(),
            self.appt1_clinicians,
            busy_serialno=self.serialno,
            override_emergencies=self.ignore_emergency_spaces)

        if self.app1_is_scheduled:
            self.set_primary_slots([])
        else:
            self.set_primary_slots(
                appointments.getLengthySlots(all_slots, self.app1_length))

        app2_slots = []
        if self.is_searching_for_double_appointments and \
                not self.app2_is_scheduled:
            all_slots = appointments.future_slots(
                startday.toPyDate(),
                sunday.toPyDate(),
                self.appt2_clinicians,
                busy_serialno=self.serialno,
                override_emergencies=self.ignore_emergency_spaces)
            self.set_secondary_slots(
                appointments.getLengthySlots(all_slots, self.app2_length))
            app1_slots = set([])
            if self.app1_is_scheduled:
                iterset = [self.appointment_model.currentAppt.to_freeslot()]
            else:
                iterset = self.primary_slots
            for app1_slot in iterset:
                for app2_slot in self.secondary_slots:
                    wait = app1_slot.wait_time(self.app1_length,
                                               self.app2_length, app2_slot)
                    if wait is not None and wait <= MAX_WAIT:
                        app2_slots.append(app2_slot)
                        app1_slots.add(app1_slot)
            if not self.app1_is_scheduled:
                self.set_primary_slots(app1_slots)

        self.set_secondary_slots(app2_slots)
Пример #3
0
    def has_issues(self):
        example_name = _("Example Dental Practice")
        has_issues = (len(localsettings.cashbookCodesDict) < 1
                      or len(localsettings.activedents) < 1
                      or localsettings.PRACTICE_NAME == example_name)

        if not has_issues:
            return False

        if not localsettings.activedents:
            but = QtWidgets.QPushButton(_("How do I Fix This?"))
            but.clicked.connect(self.show_add_clinician_advise)
            message = _("Your database contains no dentists")
            self.form_layout.addRow(message, but)

        if localsettings.PRACTICE_NAME == example_name:
            but = QtWidgets.QPushButton(_("How do I Fix This?"))
            but.clicked.connect(self.show_edit_practice)
            message = "%s <b>'%s'</b>" % (_("Your practice name is"),
                                          example_name)
            self.form_layout.addRow(message, but)

        if len(
                appointments.future_slots(localsettings.currentDay(),
                                          localsettings.BOOKEND,
                                          list(localsettings.apptix.values()),
                                          override_emergencies=True)) == 0:
            but = QtWidgets.QPushButton(_("Why is this?"))
            but.clicked.connect(self.show_appt_space)
            message = _("You have no appointment space in your diary!")
            self.form_layout.addRow(message, but)

        return True
    def has_issues(self):
        example_name = _("Example Dental Practice")
        has_issues = (
            len(localsettings.cashbookCodesDict) < 1 or
            len(localsettings.activedents) < 1 or
            localsettings.PRACTICE_NAME == example_name
        )

        if not has_issues:
            return False

        if not localsettings.activedents:
            but = QtGui.QPushButton(_("How do I Fix This?"))
            but.clicked.connect(self.show_add_clinician_advise)
            message = _("Your database contains no dentists")
            self.form_layout.addRow(message, but)

        if localsettings.PRACTICE_NAME == example_name:
            but = QtGui.QPushButton(_("How do I Fix This?"))
            but.clicked.connect(self.show_edit_practice)
            message = "%s <b>'%s'</b>" % (
                _("Your practice name is"),
                example_name)
            self.form_layout.addRow(message, but)

        if len(appointments.future_slots(localsettings.currentDay(),
                                         localsettings.BOOKEND,
                                         localsettings.apptix.values(),
                                         override_emergencies=True)
               ) == 0:
            but = QtGui.QPushButton(_("Why is this?"))
            but.clicked.connect(self.show_appt_space)
            message = _("You have no appointment space in your diary!")
            self.form_layout.addRow(message, but)

        return True