saurabhbhatia / microworld

An MIS for Microcredit Organizations and Self Help Groups
http://www.touchonelife.org/
14 stars 1 forks source link

Assigning Acct Number #10

Open saurabhbhatia opened 13 years ago

saurabhbhatia commented 13 years ago

Tdy i have finnally started using the software to maintain records for second cycle of BK.

I had entered some data on my pc earlier for demo and i could not delete or amend the amt, which is good.

however since now i wanted to use it for good, i had to delete all individual.

Now the issue

I will start feeding the data for this month once above issue gets sorted. I cant enter data with id no of first person showing 27 or 29.

this would be our data for second cycle of BK.

thanks

asif

naruvimama commented 13 years ago

We could add an 'account number' column to the user table. And we could use the relation to access the account. But when someone has to be moved from one group to another, her individual account would remain unaffected (Change the account number and group_id in the user column) . However, since the group account is everyone's money pooled in together, it would be required to close the account and reopen one in the new group? I am not sure of how group accounts function.

naruvimama commented 13 years ago

Changes made:

It was suggested in the meeting that a new table be created containing "user id", "group id" and "Account number". But to prevent duplication of data, I decided to add the "account number" to the "users" table which already contains the two ids necessary. This User model is currently used in a restful controller. The new functionallity to be added are : If a users (or account holders) account number is not already assigned and is left blank while creating or editing a user it is auto assigned as Gxx where G is the group id and xx is the largest number yet to be assigned to anyone in that group. If the account number has already been assigned then the user can be updated or created with the required account number.

To make this changes, the update_attributes and save methods used in the user_controller was replaced with update_attributes_modified and save_modified respectively. These methods are implemented in the User model class, these modified methods make a call to the private function "assign_account_number" incase the account_number is not given explicitly by the feeder.

Also since the assign_account_number requires the group_id, it is checked for in the controller before making calls to the *_modified methods. The assign_account_number method is mostly self explanatory.

A validate uniqueness of account number was also added to prevent giving two users the same account number.