Thank you

Opw has come to an end and looking back I feeel so proud and happy.I become more confident .I figured out what I want to do next.I also had fun, met a lot of amazing people .All good things come to an end. This is a small thank you note to thank all those wonder full people who have helped me in making this internship the best opportunity I ever had. My parents friends for their constant support and motivation.There are some persons I specifically want to thank

Rebecca Billings: My mentor,I am so privileged to have her as my mentor.I am really inspired by her the way she organizes her time.I have learned to organize my time.My commmunication skill has improved over the time,it is because of her.

Bob Silverberg:  I have improved a lot pair programming with him.I learned not just scripting in python but modularizing code so that its make the code more readable.He gives  exceptionally good PR reviewer that hardly any bug goes unnoticed. He has been patient when i took time more than required.

Stephend mbrand and mozwebqa team.I owe you a lot.Thanking for the constant support and words of motivation.I like to explore more

Data Migration in Django

Changing the database is one side of the equation, but often a migration involves changing data as well;

Consider this case

Bug 1096431 Able to create tasks with duplicate names.Task names should be unique

class Task:

     name = models.CharField(max_length=255, verbose_name=title)

    start_date = models.DateTimeField(blank=True, null=True)
Solution

Schema migration of course. ie Add unique = True. If you apply this migration to production it will cause an IntergrityError because you make a database column unique, while it’s contents are not unique. To solve this you need to find all tasks with duplicate names and rename them to something unique. This will be a datamigration instead of a schemamigration. Thanks to Giorgos Logiotatidis for the guidance,

Step1 : Create a few task with same names say ‘task’

Step2 : This is datamigration part

python manage.py datamigration Tasks _make_taskname_unique.py

Step 3: When you Open up the newly created file you can see the skeleton  of forwards and backwards function.I wrote a code to rename the duplicate taskname.


Step4 : Now add the unique keyword to the field and apply a schemamigration

Step5 :Finally migrate the model tasks.Now you can the the duplicate tasks gets renamed as  task 2 task 3 etc

First week Tasks

It took pretty long time to get into my blog. The code is yet to be merged .But I must say it was challenging and interesting.

Task1: Display users who have completed a given task on the task detail page

How i did?

I wrote  a simple method to the model Task which returns the list of users who have completed the given task.

@property
def users_who_completed_this_task(self):
return User.objects.filter(
taskattempt__in=TaskAttempt.objects.filter(
task=self.id, state=TaskAttempt.FINISHED)).distinct()

The property decorator lets you to access the method as an attribute of the class. So that if task1 is an instance of the model Task, task1.users_who_completed_task returns all users who completed the specific task.

My first unit test case

  • This was most challenging and exciting part.I wrote unit test cases for the code i wrote.Thanks to Bob silverberg for the helping me with  constant feedbacks. If you are new to unit testing this check this link.🙂

Task2: Add date completed in the Task Activity page

This was quite easy . 🙂

modified=attempt.modified.strftime(‘%Y-%m-%d: %I:%M:%S %p’).lower())

What i learned

    • Some simple filters used in jinja2 templates like strfttime. Here is a simple code snippet for a comma separated list of users in the template

 {% for each_user in users %}
{{ each_user.profile.name }}{% if not loop.last %},{% endif %}
{% endfor %}

  • Writing unit testcase

Patches submitted for OPW Internship

In this post i shall explain about the patches i submitted for gnome opw.After going through all the projects i choose Mozilla oneanddone which is basically a task board where contributers can pick a task and feel good about them.Tasks usually includes automation,manual testing,verification etc.This site is written in django and playdolph.I have submitted three patches to the project

patch1: Made Task description intended not required

Make the task description optional.Find the field in the table that stories task description.Set null on the column in database and in forms allow this field to be left blank.In django it simple a line of code in the model

short_description = models.CharField(blank=True, null=True, max_length=255, verbose_name=description)

and use south for migration

Step 2:  manage.py schemamigration tasks –initial

manage.py migrate tasks

patch 2: Add an optional personal url in users profile:

My favorite part was writing a custom form field for personal url

http://csnipp.com/s/830

Patch2:Linkify home page

Learned about translational strings )

patch 2

My first dive into opensource

typographic-quote

Its official.I  am glad that i am an   OPW  intern.This means ill be working with mozilla for three months (Dec9th-March 12). As a part of the internship  i will be filling this little space of mine with my  internship experience. Stay tuned! :). So let me begin by telling a few  words about myself and how i started with open source.

I am Tessy, from India a recent computer science graduate.I have been working in startup for about six months .I love attending online courses,learning new stuffs.Python is my favorite programming languages. I have always been curious about software development.During my free time i love reading traveling,being around with people.

I have not contributed to open source projects before and I admired the people who have. It sounded very cool.So when i first heard about opw an year ago i knew i was in.Since I was familiar with python,i choose Fedoras infrastructure upstream,porting to python 3.It was tough for a novice but worth trying.Finally i managed to submit a small patch .It was quite simple removing 5 lines of code:).I was rejected .Participation and rejection are a part of game.I was not selected for round 8.

Though i was rejected twice,I was not ready to give up.I started browsing various organization and choose mozilla.I started involving with the documentation team by joining the joining the Army of Awsome  and answering questions in support forum.Programming was my area of interest.but i learned it is not a good idea to jump directly into code.Testing is a field which is good to begin with.So during my free time i spend volunteering mozillas automated testing efforts.I started subscribing to the mailing list and during my free time i hanged around the irc channel.Picking up community tagged issues including  writing readme,cleaning up the repository removing unused codes, and getting recognized with badges was motivating.So by the time when round 9 was announced ,it was easier to tackle the issues

Finally round 9 was announced,Since i was already familiar with mozilla’s quality assurance I choose one and done project.Its a mozilla qa teams new tool where new contributes can pick task,complete them helping the qa community and feel rewarded with badges.Its written in django and playdoh.

For those who are looking forwards to contribute to open source, don’t hesitate Select a community project you find interesting,If you are beginner make sure  the community is  friendly to beginners. Start by subscribing to mailing list,hang  around in ircs.Send  a mail explaining your area of interest,level of expertise.They will get back to you.I would encourage all those who are qualify the criteria of opw to apply for the next round.Working with smarter people is the best way to grow.

Its been a week since the internship started and I learned a lot.The journey so far has been quite exciting,Thanks to my mentors Rebecca Billings and Bob Silverberg.I hope it will be the same in future also.