示例#1
0
    def handle(self, *args, **kwargs):
        creation_count = 0

        authors = Author.objects.raw("""
            SELECT janeway_author.*
            FROM
            (SELECT janeway_name.author_id, count(demoscene_nickvariant.name)
            FROM janeway_name
            LEFT JOIN demoscene_nickvariant on (lower(janeway_name.name) = lower(demoscene_nickvariant.name))
            GROUP BY janeway_name.author_id
            HAVING count(demoscene_nickvariant.name) = 0
            ) AS unseen_names
            INNER JOIN janeway_author ON (unseen_names.author_id = janeway_author.id)
            WHERE is_company = 'f'
            AND janeway_author.janeway_id NOT IN (select cast(parameter as int) from demoscene_releaserexternallink where link_class='KestraBitworldAuthor')
        """)

        for (index, author) in enumerate(authors):
            if (index % 100 == 0):
                print("processed %d authors" % index)

            import_author(author)

            creation_count += 1

        print("%d authors created" % creation_count)
示例#2
0
    def test_releaser_without_nick_match(self):
        tmb_janeway = Author.objects.get(name="TMB Designs")
        tmb_demozoo = Releaser.objects.create(name="TMB", is_group=False)
        tmb_designs_nick = tmb_demozoo.nicks.create(name="not tmb designs")
        tmb_demozoo.external_links.create(link_class='KestraBitworldAuthor',
                                          parameter=tmb_janeway.janeway_id)

        import_author(Author.objects.get(name="Spaceballs"))
        import_release(Release.objects.get(title="State Of The Art"))
        self.assertTrue(
            Production.objects.get(title="State Of The Art").credits.filter(
                nick=tmb_demozoo.primary_nick).exists())
示例#3
0
    def test_import_member_first(self):
        import_author(Author.objects.get(name="TMB Designs"))
        import_author(Author.objects.get(name="Spaceballs"))
        import_release(Release.objects.get(title="State Of The Art"))

        self.assertTrue(Releaser.objects.filter(name="Spaceballs").exists())
        self.assertTrue(Releaser.objects.filter(name="TMB Designs").exists())
        self.assertTrue(
            Releaser.objects.get(name="TMB Designs").nicks.filter(
                name="TMB").exists())
        self.assertTrue(
            Releaser.objects.get(name="Spaceballs").member_memberships.filter(
                member__name="TMB Designs").exists())
        sota = Production.objects.get(title="State Of The Art")
        self.assertTrue(sota.credits.filter(nick__name="TMB Designs").exists())
        self.assertTrue(sota.platforms.filter(name="Amiga OCS/ECS").exists())
示例#4
0
    def test_import_group_first(self):
        import_author(Author.objects.get(name="Spaceballs"))
        import_author(Author.objects.get(name="TMB Designs"))
        import_release(Release.objects.get(title="State Of The Art"))

        self.assertTrue(Releaser.objects.filter(name="Spaceballs").exists())
        self.assertTrue(Releaser.objects.filter(name="TMB Designs").exists())
        self.assertTrue(
            Releaser.objects.get(name="TMB Designs").nicks.filter(
                name="TMB").exists())
        self.assertTrue(
            Releaser.objects.get(name="Spaceballs").member_memberships.filter(
                member__name="TMB Designs").exists())
        sota = Production.objects.get(title="State Of The Art")
        self.assertTrue(sota.credits.filter(nick__name="TMB Designs").exists())
        self.assertTrue(sota.platforms.filter(name="Amiga OCS/ECS").exists())
        self.assertTrue(
            sota.links.filter(
                link_class='AmigascneFile',
                parameter='/Groups/S/Spaceballs/Spaceballs-StateOfTheArt.dms',
                source='janeway').exists())