Skip to content

Commit

Permalink
Moar updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ca9 committed Jun 26, 2014
1 parent 26eae9f commit c596b47
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 60 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ out/
# generated by JIRA plugin
atlassian-ide-plugin.xml

# Migrations
migrations
migrations/*

# generated by Crashlytics plugin (for Android Studio and Intellij)
com_crashlytics_export_strings.xml

# specific files
dev_file.py
dev_file.pyc



28 changes: 27 additions & 1 deletion coursereview/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ class Faculty(models.Model):
#Foreign key to many reviews (as faculty too)
teaches = models.ManyToManyField('Course', related_name="taughtBy")

def ReviewAdder(course, review):
course.numReviews += 1

course.easeOfScoring += review.easeOfScoring
course.industryApplication += review.industryApplication
course.interesting += review.interesting
course.easeOfContent += review.easeOfContent
course.workload += review.workload
course.qualityTeaching += review.qualityTeaching
course.relevance += review.relevance
course.technicality += review.technicality
course.projectBurden += review.projectBurden



class Review(models.Model):
Expand All @@ -45,7 +58,7 @@ class Review(models.Model):
#please do not touch. DateField, not TimeField.
createdTime = models.DateField()
#Is the review anonymous?
anon = models.BooleanField()
anon = models.BooleanField(default=False)
yearChoices = tuple([(x, x) for x in range(2007, datetime.datetime.now().year + 1)])
yearTaken = models.IntegerField(choices=yearChoices)
semTaken = models.PositiveSmallIntegerField(default=1)
Expand Down Expand Up @@ -75,6 +88,19 @@ class Course(models.Model):
courseID = models.CharField(max_length=6, blank="True", null="True")
name = models.CharField(max_length=256, blank="True", null="True")
hasProject = models.BooleanField(default=False)

numReviews = models.IntegerField(default=0)

easeOfScoring = models.IntegerField(default=5)
industryApplication = models.IntegerField(default=5)
interesting = models.IntegerField(default=5)
easeOfContent = models.IntegerField(default=5)
workload = models.IntegerField(default=5)
qualityTeaching = models.IntegerField(default=5)
relevance = models.IntegerField(default=5)
technicality = models.IntegerField(default=5)
projectBurden = models.IntegerField(default=5)

#taught_by

#Foreign key to many reviews
Expand Down
2 changes: 1 addition & 1 deletion coursereview/templates/home/bhome.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h2>the <span class="focus">how</span>.</h2>

<p>
<ul>
<li class="left">Nailed a course? Got nailed down by another? Review it.</li>
<li class="left">Nailed a course? Got pwnd by another? Review it.</li>
<li class="right">Have a large heart. Share the pearls of wisdom and experience.</li>
<li class="left">Access a database of comprehensive reviews of past experiences with courses.</li>
<li class="right">Find the ones that fit your requirements.</li>
Expand Down
17 changes: 0 additions & 17 deletions coursereview/templates/home/contact_us.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,10 @@ <h2 class="contact_h2">Contact Us</h2>
<h4 class="contact_h4">EMAIL</h4>

<table class="email-href" >
<tr class="spaceUnder">
<td><a class="contact_name">Aakarsh Malhotra</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Abhishek Jain</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Aditya Gupta</a> </td>
<td> <a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Ankur Sial</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Vinayak Shukl</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>

</table>
</div>

Expand Down
17 changes: 0 additions & 17 deletions coursereview/templates/home/contact_us2.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,10 @@ <h2 class="contact_h2">Contact Us</h2>
<h4 class="contact_h4">EMAIL</h4>

<table class="email-href" >
<tr class="spaceUnder">
<td><a class="contact_name">Aakarsh Malhotra</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Abhishek Jain</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Aditya Gupta</a> </td>
<td> <a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Ankur Sial</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>
<tr class="spaceUnder">
<td><a class="contact_name">Vinayak Shukl</a></td>
<td><a href="mailto:[email protected]" class="contact_email">[email protected]</a></td>
</tr>

</table>
</div>

Expand Down
5 changes: 3 additions & 2 deletions coursereview/templates/home/features.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ <h2 class="faq_h2">Features</h2>
<img src="{% static "img/features1.jpg" %}"/>
<img src="{% static "img/features2.jpg" %}"/>
<br/>
<b> 6 months in, that is exactly what our 5-man team of <a href="/contact"> code-husslin deadline-bustlin
grumpies </a> does. </b>
<b> 6 months later, CourseReview was born. The code here is owned and maintained by Aditya Gupta,
with significant contribution from Vinayak Shukl, both from IIITD. Early contributors:
Ankur Sial, Abhishek Singh, and Aakarsh Malhotra. </b>
<br/><br/>
</p>
</div>
Expand Down
28 changes: 14 additions & 14 deletions coursereview/templates/home/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@
<li class="signin">
<!--div onclick="location.href='/google/login/'"-->
<div>
<a href="/accounts/login">
<button class="btn" id="signin-button" onmouseover="showIIITD(this)" title="For iiitd.ac.in accounts only.">
<i class="icon-signin"></i> Sign in
</button>
<script>
function showIIITD(x){
x.tooltip({
position: "center right",
offset: [-2, 10],
effect: "fade",
opacity: 0.7
});
}
</script>
<a title="Google" class="socialaccount_provider google" href="/accounts/google/login/?process=login">
<button class="btn" id="signin-button" onmouseover="showIIITD(this)" title="For iiitd.ac.in accounts only.">
<i class="icon-signin"></i> Sign in
</button>
<script>
function showIIITD(x){
x.tooltip({
position: "center right",
offset: [-2, 10],
effect: "fade",
opacity: 0.7
});
}
</script>
</a>
</div>
</li>
Expand Down
14 changes: 10 additions & 4 deletions coursereview/templates/home/user_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,25 @@
<li><a class="dropdown-toggle" data-toggle="dropdown" href="#">Browse Reviews</a></li>
</ul>
</div-->

<li class="signout">
<form method="post" action="/accounts/logout/">
<button type="submit" class="btn" id="signout-button">
<i class="icon-signin"></i> Log out
</button>
</form>
</li>
<!--li class="signout">
<div onclick="location.href='/logout'">
<button class="btn" id="signout-button">
<i class="icon-signin"></i> Log out
</button>
</div>
</li>
<li>
</li-->
<!--li>
<div class="feedback" data-toggle="modal" data-target="#Feedback">
<div class="feedback-text"><p></p> <b> F E E D B A C K </b> </div>
</div>
</li>
</li-->
</ul>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions coursereview/templates/home2/review_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ <h3 class="page-header">Search for Reviews</h3>
width: 15px;
}

td.course {
text-align: center;
}

td.faculty {
text-align: center;
width: 180px;
}

Expand Down
8 changes: 4 additions & 4 deletions coursereview/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def seereview(request):
prof = x.faculty.name
overall = [x.easeOfScoring, x.easeOfContent, x.industryApplication, x.interesting, x.workload, x.qualityTeaching, x.relevance, x.technicality, x.projectBurden]
overall = round(1.0*sum(overall)/len(overall), 3)
reviewer = UserProfile.objects.get(user = x.reviewer)
reviewer = x.reviewer
return render(request, 'templates/home2/review_review.html',
{'user': request.user, 'rev': x, 'overall': overall, 'reviewer': reviewer,
'bar': int(overall*10), 'title': "CourseReview - Review", 'prof': prof})
Expand All @@ -295,7 +295,7 @@ def vote(request):
if GET.has_key(u'pk') and GET.has_key(u'vote'):
pk = int(GET[u'pk'])
vote = GET[u'vote']
myUser = User.objects.get(email = GET[u'myUser'])
myUser = UserProfile.objects.get(email = GET[u'myUser'])
myReview = Review.objects.get(pk=pk)
if vote == u"up":
if myUser in myReview.downvoters.all():
Expand Down Expand Up @@ -386,7 +386,7 @@ def report(request):
GET = request.GET
if GET.has_key(u'pk'):
pk = int(GET[u'pk'])
myUser = User.objects.get(email = GET[u'myUser'])
myUser = UserProfile.objects.get(email = GET[u'myUser'])
myReview = Review.objects.get(pk=pk)
results['mess'] = "You have already reported this review."
if myUser not in myReview.reporter.all():
Expand Down Expand Up @@ -422,7 +422,7 @@ def seecourse(request):
courseOverall[i] += overall[i]
lname = "Anonymous"
if not x.anon:
lname = UserProfile.objects.get(user = x.reviewer).name
lname = x.reviewer.name
lrevs += [[x.upvotes, x.id, round(sum(overall)*1.0/len(overall), 3), lname]]
lrevs.sort()
lrevs = lrevs[::-1]
Expand Down

0 comments on commit c596b47

Please sign in to comment.