Permalink
Browse files

get stuff working for DEMO. some views have extra crap now

  • Loading branch information...
1 parent 5a91196 commit 6ae41dca63adb91de3696833d4027ff4669fe45a @talklittle committed Dec 8, 2010
@@ -41,6 +41,7 @@ def edit
# POST /systems.xml
def create
@system = System.new(params[:system])
+ @system.user = current_user
respond_to do |format|
if @system.save
View
@@ -7,6 +7,10 @@ class Script
property :id, Serial
property :size_bytes, Integer, :required => false
property :code, Blob, :required => true
+ property :purpose, String, :required => true
+ property :success_condition, Blob, :required => true
+ property :test_data, Blob, :required => false
+ property :man_page, Blob, :required => true
property :upvote_user_ids, List
timestamps :at
View
@@ -23,17 +23,17 @@ def relevance(user_id)
self.tag_ids.each do |tag_id|
tag = Tag.get(tag_id)
has_match = false
- for user.systems.each do |sys|
+ user.systems.each do |sys|
if tag.systems.include?(sys)
has_match = true
- if not matching_types.include?(tag.type)
+ if !matching_types.include?(tag.type)
matching_types << tag.type
break
end
end
end
if has_match
- num_matching += 1
+ num_matching = num_matching + 1
end
end
return [matching_types.size, num_matching]
View
@@ -23,6 +23,23 @@ class User
has n, :comments
has n, :test_outputs
+ def relevant_tasks
+ return Task.all
+ tasks = []
+ Task.all.each do |t|
+ tasks << [t, t.relevance(self.id)]
+ end
+ return_tasks = []
+ tasks.sort do |a, b|
+ res = a[1][0] <=> b[1][0]
+ res = a[1][1] <=> b[1][1] if res == 0
+ end
+ tasks.each do |t|
+ return_tasks << t[0]
+ end
+ return_tasks
+ end
+
def password=(password)
@password = password
end
@@ -1,5 +1,8 @@
<div id="header" class="round">
- <%= link_to image_tag("logo.png", :alt => "CrowdTest"), root_path %>
+ <span>
+ <%= link_to image_tag("logo.png", :alt => "CrowdTest", :width => 80, :height => 80), root_path %>
+ <b style="color:white;font-size:24pt">CrowdTest</b>
+ </span>
<ul class="navigation round">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Tasks", tasks_path %></li>
@@ -14,6 +14,22 @@
<%= f.text_area(:code, :cols => 80, :rows => 40) %>
</p>
<p>
+ <%= f.label :purpose %><br />
+ <%= f.text_field :purpose %>
+ </p>
+ <p>
+ <%= f.label :success_condition %><br />
+ <%= f.text_area(:success_condition, :cols => 80, :rows => 10) %>
+ </p>
+ <p>
+ <%= f.label :test_data %><br />
+ <%= f.text_area(:test_data, :cols => 80, :rows => 10) %>
+ </p>
+ <p>
+ <%= f.label :man_page %><br />
+ <%= f.text_area(:man_page, :cols => 80, :rows => 10) %>
+ </p>
+ <p>
<%= f.submit 'Create' %>
</p>
<% end %>
@@ -18,6 +18,13 @@
<%=h @script.num_upvotes %>
</p>
+<p>
+<b>Comments:</b><br />
+<ul>
+ <li>Perfect! -- <b>0 upvotes</b></li>
+ <li>The collection part works if all Linux machines, but breaks when you add Windows -- <b>2 upvotes</b></li>
+</ul>
+
<p id="upvote">
<% if signed_in? %>
<% if @script.upvoted?(current_user) %>
@@ -1,4 +1,33 @@
-<h1>Listing tasks</h1>
+<% if signed_in? %>
+ <h1>Relevant tasks</h1>
+
+ <table>
+ <tr>
+ <th>Tested</th>
+ <th>Expire date</th>
+ <th>Description</th>
+ <th>Duration minutes</th>
+ <th>Tags</th>
+ </tr>
+
+ <% current_user.relevant_tasks.each do |task| %>
+ <tr>
+ <td><%=h task.tested %></td>
+ <td><%=h task.expire_date %></td>
+ <td><%=h task.description %></td>
+ <td><%=h task.duration_minutes %></td>
+ <td><%=h task.tags %></td>
+ <td><%= link_to 'Show', task %></td>
+ <!-- <td><%= link_to 'Edit', edit_task_path(task) %></td> -->
+ <% if task.user == current_user %>
+ <td><%= link_to 'Destroy', task, :confirm => 'Are you sure?', :method => :delete %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+<% end %>
+
+<h1>All tasks</h1>
<table>
<tr>
@@ -23,6 +23,27 @@
<%=h @user.requester_score %>
</p>
+<table>
+ <tr>
+ <th>Cpu mhz</th>
+ <th>Ram mbytes</th>
+ <th>Os</th>
+ <th>Tags</th>
+ </tr>
+
+<% @user.systems.each do |system| %>
+ <tr>
+ <td><%=h system.cpu_mhz %></td>
+ <td><%=h system.ram_mbytes %></td>
+ <td><%=h system.os %></td>
+ <td><%=h system.tags %></td>
+ <td><%= link_to 'Show', system %></td>
+ <td><%= link_to 'Edit', edit_system_path(system) %></td>
+ <td><%= link_to 'Destroy', system, :confirm => 'Are you sure?', :method => :delete %></td>
+ </tr>
+<% end %>
+</table>
+
<%= link_to 'Edit', edit_user_path(@user) %> |
<%= link_to 'Back', users_path %>

0 comments on commit 6ae41dc

Please sign in to comment.