Exemple #1
0
    def export(self):
        export_dir = join(
            self.export_base_dir,
            datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
        )

        try:
            mkdir(export_dir)
        except OSError:
            pass

        dump_csv(Session.select(Session.name, Session.date), join(export_dir, 'sessions.csv'))
        dump_csv(Member.select(Member.tag_id, Member.name), join(export_dir, 'members.csv'))
        for session in Session.select():
            dump_csv(
                SessionAttendance.select(
                    SessionAttendance.session,
                    SessionAttendance.member
                ).where(
                    SessionAttendance.session == session.id
                ), join(
                    export_dir,
                    'session_{}.csv'.format(session.name.replace(' ', '_'))
                )
            )

        toast('Successfully exported to \n{}'.format(export_dir))
        self.update_interface()
Exemple #2
0
 def update_interface(self, *args):
     self.ids.session_list.adapter = ListAdapter(
         data=Session.select(),
         args_converter=self.arg_converter,
         selection_mode='none',
         cls=CompositeListItem
     )
     self.ids.session_list.adapter.bind(data=self.session_data_changed)
Exemple #3
0
 def update_interface(self, *args):
     self.ids.session_list.adapter = ListAdapter(
         data=Session.select(
             SessionAttendance, Member, Session
         ).join(SessionAttendance).join(Member).where(SessionAttendance.member == self.member_id),
         args_converter=self.arg_converter,
         selection_mode='none',
         cls=CompositeListItem
     )
     self.ids.session_list.adapter.bind(data=self.session_data_changed)