Example #1
0
 def standalone_columns(self):
     return [
         StandaloneReportColumn("participant_id", 'profile', 'string',
                                'Randomized Participant Id',
                                lambda x: random_user(x.username)),
         StandaloneReportColumn(
             "optionb_percent_complete", 'profile', 'percent',
             '% of hierarchy completed',
             lambda x: x.profile.percent_complete_optionb()),
         StandaloneReportColumn(
             "group", 'profile', 'list', 'Option B+ Groups',
             lambda x: ",".join(x.profile.get_groups_by_hierarchy('main'))),
     ]
class PagetreeReportColumnTest(PagetreeTestCase):
    def setUp(self):
        super(PagetreeReportColumnTest, self).setUp()

        self.column = StandaloneReportColumn('username', 'profile', 'string',
                                             'Username', lambda x: x.username)

    def test_identifier(self):
        self.assertEquals(self.column.identifier(), 'username')

    def test_metadata(self):
        key_row = ['', 'username', 'profile', 'string', 'Username']
        self.assertEquals(self.column.metadata(), key_row)

    def test_user_value(self):
        user = UserFactory()
        self.assertEquals(self.column.user_value(user), user.username)
Example #3
0
 def standalone_columns(self):
     return [
         StandaloneReportColumn('participant_id', 'profile', 'string',
                                'Participant Id', lambda x: x.username),
         StandaloneReportColumn('research_group', 'profile', 'string',
                                'Research Group',
                                lambda x: x.profile.research_group),
         StandaloneReportColumn('percent_complete', 'profile', 'percent',
                                '% of hierarchy completed',
                                lambda x: x.profile.percent_complete()),
         StandaloneReportColumn(
             'first_access', 'profile', 'date string', 'first access date',
             lambda x: x.profile.first_access_formatted()),
         StandaloneReportColumn('last_access', 'profile', 'date string',
                                'last access date',
                                lambda x: x.profile.last_access_formatted())
     ]
Example #4
0
class PagetreeReportColumnTest(PagetreeTestCase):

    def setUp(self):
        super(PagetreeReportColumnTest, self).setUp()

        self.column = StandaloneReportColumn('username', 'profile',
                                             'string', 'Username',
                                             lambda x: x.username)

    def test_identifier(self):
        self.assertEquals(self.column.identifier(), 'username')

    def test_metadata(self):
        key_row = ['', 'username', 'profile', 'string', 'Username']
        self.assertEquals(self.column.metadata(), key_row)

    def test_user_value(self):
        user = UserFactory()
        self.assertEquals(self.column.user_value(user), user.username)
    def setUp(self):
        super(PagetreeReportColumnTest, self).setUp()

        self.column = StandaloneReportColumn('username', 'profile', 'string',
                                             'Username', lambda x: x.username)
Example #6
0
    def setUp(self):
        super(PagetreeReportColumnTest, self).setUp()

        self.column = StandaloneReportColumn('username', 'profile',
                                             'string', 'Username',
                                             lambda x: x.username)
Example #7
0
 def standalone_columns(self):
     return [
         StandaloneReportColumn("date_joined", 'profile', 'string',
                                'Date joined', lambda x: x.date_joined),
         StandaloneReportColumn("userid", 'profile', 'string', 'Unique ID',
                                lambda x: x.pk),
         StandaloneReportColumn(
             "gender", 'profile', 'char', GENDER_CHOICES,
             lambda x: self.get_profile_value(x, 'gender')),
         StandaloneReportColumn(
             "primary_discipline", 'profile', 'string', DISCIPLINE_CHOICES,
             lambda x: self.get_profile_value(x, 'primary_discipline')),
         StandaloneReportColumn(
             "primary_other_discipline", 'profile', 'string',
             'Primary other discipline', lambda x: self.get_profile_value(
                 x, 'primary_other_discipline')),
         StandaloneReportColumn(
             "primary_other_dental_discipline", 'profile', 'string',
             'Primary other dental discipline',
             lambda x: self.get_profile_value(
                 x, 'primary_other_dental_discipline')),
         StandaloneReportColumn(
             "work_description", 'profile', 'string', 'Work description',
             lambda x: self.get_profile_value(x, 'work_description')),
         StandaloneReportColumn(
             "state", 'profile', 'string', 'State',
             lambda x: self.get_profile_value(x, 'state')),
         StandaloneReportColumn(
             "year_of_graduation", 'profile', 'integer',
             'Year of graduation',
             lambda x: self.get_profile_value(x, 'year_of_graduation')),
         StandaloneReportColumn(
             "dental_school", 'profile', 'string', DENTAL_SCHOOL_CHOICES,
             lambda x: self.get_profile_value(x, 'dental_school')),
         StandaloneReportColumn(
             "postal_code", 'profile', 'string', 'Postal code',
             lambda x: self.get_profile_value(x, 'postal_code')),
         StandaloneReportColumn(
             "plan_to_teach", 'profile', 'string', AGREEMENT_CHOICES,
             lambda x: self.get_profile_value(x, 'plan_to_teach')),
         StandaloneReportColumn(
             "qualified_to_teach", 'profile', 'string', AGREEMENT_CHOICES,
             lambda x: self.get_profile_value(x, 'qualified_to_teach')),
         StandaloneReportColumn(
             "opportunities_to_teach", 'profile', 'string',
             AGREEMENT_CHOICES,
             lambda x: self.get_profile_value(x, 'opportunities_to_teach')),
         StandaloneReportColumn(
             "possible_to_teach", 'profile', 'string', AGREEMENT_CHOICES_EX,
             lambda x: self.get_profile_value(x, 'possible_to_teach')),
         StandaloneReportColumn(
             "ethnicity", 'profile', 'string', ETHNICITY_CHOICES,
             lambda x: self.get_profile_value(x, 'ethnicity')),
         StandaloneReportColumn(
             "race", 'profile', 'string', RACE_CHOICES_EX,
             lambda x: self.get_profile_value(x, 'race')),
         StandaloneReportColumn("age", 'profile', 'string', AGE_CHOICES,
                                lambda x: self.get_profile_value(x, 'age')),
         StandaloneReportColumn(
             "highest_degree", 'profile', 'string', DEGREE_CHOICES,
             lambda x: self.get_profile_value(x, 'highest_degree')),
         StandaloneReportColumn(
             "consented", 'profile', 'boolean', 'Consent given',
             lambda x: self.get_profile_value(x, 'consented'))
     ]
Example #8
0
 def standalone_columns(self):
     return [
         StandaloneReportColumn("username", 'profile', 'string',
                                'Unique Username', lambda x: x.username)
     ]