Skip to content

Commit

Permalink
status: Save members did not send count in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithpabbati committed Mar 16, 2020
1 parent 7f6922b commit 1ce9be2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion members/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ProfileAdmin(admin.ModelAdmin):
'user',
('first_name', 'last_name', 'profile_pic'),
('email', 'phone'),
('telegram_id', 'githubUsername')
('telegram_id', 'githubUsername', 'didNotSendStreak')
]
}),
('Additional Details', {
Expand All @@ -51,6 +51,7 @@ class ProfileAdmin(admin.ModelAdmin):
}),

]
readonly_fields = ('didNotSendStreak', )
inlines = (sp_inline, wexp_inline, eq_inline)
list_display = ('first_name', 'last_name', 'batch')
list_filter = ('batch',)
Expand Down
1 change: 1 addition & 0 deletions members/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def get_resume_path(self, filename):
interests = models.ManyToManyField(Skill, related_name='interests', blank=True)
expertise = models.ManyToManyField(Skill, related_name='expertise', blank=True)
experiences = models.ManyToManyField(Organization, related_name='WorkExperiences', through='WorkExperience')
didNotSendStreak = models.IntegerField(default=0)
qualifications = models.ManyToManyField(
Organization,
related_name='EducationalQualifications',
Expand Down
6 changes: 4 additions & 2 deletions status/StatusUpdateReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pytz import timezone
import telegram
from status.models import Thread, DailyLog, Message, StatusException
from college.models import Profile
from members.models import Group
from members.models import Profile as UserProfile

Expand Down Expand Up @@ -58,7 +57,7 @@ def getBatchName(y):

@staticmethod
def groupMembersByBatch(members, year):
return Profile.objects.filter(user__in=members, admissionYear=year)
return UserProfile.objects.filter(user__in=members, batch=year)

@staticmethod
def getLastSendStr(last_send, expected_date):
Expand Down Expand Up @@ -116,6 +115,9 @@ def generateBatchWiseDNSReport(self, members, year):
if lastSend:
lastSend = self.getLastSendStr(lastSend,
self.getMemberLastRequiredDate(member.user))
profile = UserProfile.objects.get(user=member.user)
profile.didNotSendStreak = lastSend
profile.save()
memberHistory = self.getMemberHistory(member.user)
message += ' [ ' + lastSend + ', ' + memberHistory + ']'
else:
Expand Down

0 comments on commit 1ce9be2

Please sign in to comment.