Changeset 983
- Timestamp:
- 11/16/08 13:22:27 (7 weeks ago)
- Location:
- huginmunin/trunk/web/hm
- Files:
-
- 4 modified
-
app/views/ext_api_views.py (modified) (3 diffs)
-
app/views/quickrate_main.py (modified) (1 diff)
-
db/graph.py (modified) (1 diff)
-
db/state.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
huginmunin/trunk/web/hm/app/views/ext_api_views.py
r958 r983 115 115 if not objs: 116 116 objs.extend(model.objects.filter(label__icontains=name)) # use search instead of icontains 117 if len(objs) < 10:117 if len(objs) == 0: 118 118 objs.extend(model.objects.filter(description__icontains=name)) # use search of icontains 119 119 return objs … … 155 155 'node': ['label', 'description', 'type'], 156 156 'edge': ['label', 'description', 'parent', 'child'], 157 'review': ['label', 'description', 'interest', 'node'] 157 'review': ['label', 'description', 'interest', 'node'], 158 'node_type_cast': [], 159 'edge_type_cast': [], 158 160 } 159 161 … … 317 319 if request.GET.has_key('callback'): 318 320 callback = request.GET.__getitem__('callback') 319 json_data = { 'score': data['score'] or '', 'count': data['count'] or '' }321 json_data = { 'score': data['score'] or '', 'count': data['count'] or '', 'customized': data['customized'] or '' } 320 322 return json_response('%s(%s)' % (callback, json_data)) 321 323 else: -
huginmunin/trunk/web/hm/app/views/quickrate_main.py
r980 r983 17 17 18 18 def index(request): 19 a = Action.objects.select_related().filter(item_type__model='behavior').exclude(user=current_user()) 20 b = a[random.randint(0, a.count())].item 21 if not b.dimension: 22 return HttpResponseRedirect(reverse('select_interest', args=(b.id,))) 19 if current_user().is_authenticated(): 20 a = Action.objects.select_related().filter(item_type__model='behavior').exclude(user=current_user()) 23 21 else: 24 return HttpResponseRedirect(reverse('rate_review', args=(b.id,))) 22 a = Action.objects.select_related().filter(item_type__model='behavior') 23 if len(a) > 0: 24 b = a[random.randint(0, a.count())].item 25 if not b.dimension: 26 return HttpResponseRedirect(reverse('select_interest', args=(b.id,))) 27 else: 28 return HttpResponseRedirect(reverse('rate_review', args=(b.id,))) 29 else: 30 return render_response(request, 'quickrate/winner.html') 25 31 26 32 def select_interest(request, review_id): -
huginmunin/trunk/web/hm/db/graph.py
r963 r983 483 483 """ 484 484 try: 485 print " make: label:%s dim:%s" % (label, dimension)486 485 r = Behavior.get(label=label, dimension=dimension, description=description, node=node) 487 print "ALREADY EXISTS %s" % r488 486 # TODO use find and then check if any hae same EdgeType 489 487 raise AlreadyExists("Review %i already exists for %s, %s, %s, %s" % (r.id, r.label, r.dimension, r.description, r.node)) -
huginmunin/trunk/web/hm/db/state.py
r963 r983 5 5 6 6 import utils 7 import graph, citation 7 import graph, citation, user, tag, rating 8 8 9 9 """ … … 30 30 @cvar STATEFUL_MODELS: 31 31 32 @cvar NONE:33 @cvar VISIBLE: 34 @cvar REMOVED: 32 @cvar DRAFT: eg, added by mechanical crawler, or is a test or in-progress addition 33 @cvar VISIBLE: visible on the main site and all that 34 @cvar REMOVED: deleted...but present just in case. these might get flushed periodically? 35 35 """ 36 36 37 37 STATEFUL_MODELS = [ 38 graph.Node, graph.Edge, graph.Argument, #graph.BehaviorArgumentLink, 39 graph.Dimension, graph.Behavior, graph.UPC, 40 citation.Source, citation.Author, citation.Article, citation.Citation ] 38 graph.Node, graph.NodeType, graph.NodeTypeCast, 39 graph.Edge, graph.EdgeType, graph.EdgeTypeCast, 40 graph.Argument, graph.Dimension, graph.Behavior, graph.UPC, 41 citation.Source, citation.Author, citation.Article, citation.Citation, 42 tag.Tag, tag.Tagging, 43 #rating.Rating, ?? should we 44 user.UserInterestPercent] 41 45 42 46 @classmethod … … 65 69 66 70 # Valid States 67 NONE= 071 DRAFT = 0 68 72 VISIBLE = 1 69 73 REMOVED = 2