source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20101214034327_update_review_fields.rb | Ruby | mit | 191 | main | 1,092 | class UpdateReviewFields < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :review_assignment_strategy, :string
add_column :assignments, :max_reviews_per_submission, :integer
remove_column :assignments, :dynamic_reviewer_response_time_limit_hours
remove_column :response_maps, :potent... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130724031046_rename_user_password_to_crypted_password.rb | Ruby | mit | 191 | main | 230 | class RenameUserPasswordToCryptedPassword < ActiveRecord::Migration[4.2]
def self.up
rename_column :users, :password, :crypted_password
end
def self.down
rename_column :users, :crypted_password, :password
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20160511003610_drop_rereview_and_resubmission_from_topic_deadlines.rb | Ruby | mit | 191 | main | 224 | class DropRereviewAndResubmissionFromTopicDeadlines < ActiveRecord::Migration[4.2]
def change
remove_column :topic_deadlines, :resubmission_allowed_id
remove_column :topic_deadlines, :rereview_allowed_id
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171019205838_create_tag_prompt_deployments.rb | Ruby | mit | 191 | main | 438 | class CreateTagPromptDeployments < ActiveRecord::Migration[4.2]
def change
create_table :tag_prompt_deployments do |t|
t.references :tag_prompt, index: true, foreign_key: true
t.references :assignment, index: true, foreign_key: true
t.references :questionnaire, index: true, foreign_key: true
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/023_create_survey_responses.rb | Ruby | mit | 191 | main | 781 | class CreateSurveyResponses < ActiveRecord::Migration[4.2]
def self.up
create_table 'survey_responses', force: true do |t|
t.column 'score', :integer, limit: 8
t.column 'comments', :text
t.column 'assignment_id', :integer, limit: 8, default: 0, null: false
t.column 'question_id', :integer,... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171110231839_create_awarded_badges.rb | Ruby | mit | 191 | main | 281 | class CreateAwardedBadges < ActiveRecord::Migration[4.2]
def change
create_table :awarded_badges do |t|
t.references :badge, index: true, foreign_key: true
t.references :participant, index: true, foreign_key: true
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/054_create_tree_folders.rb | Ruby | mit | 191 | main | 465 | class CreateTreeFolders < ActiveRecord::Migration[4.2]
def self.up
create_table :tree_folders do |t|
t.column :name, :string
t.column :child_type, :string
end
TreeFolder.create(name: 'Questionnaires', child_type: 'QuestionnaireTypeNode')
TreeFolder.create(name: 'Courses', child_type: 'Cou... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/007_create_late_policies.rb | Ruby | mit | 191 | main | 625 | class CreateLatePolicies < ActiveRecord::Migration[4.2]
def self.up
create_table 'late_policies', force: true do |t|
t.column 'penalty_period_in_minutes', :integer
t.column 'penalty_per_unit', :integer
t.column 'expressed_as_percentage', :boolean
t.column 'max_penalty', :integer, default: ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20161025010205_adding_attributes_submission_code.rb | Ruby | mit | 191 | main | 414 | class AddingAttributesSubmissionCode < ActiveRecord::Migration[4.2]
def change
add_column :submission_records, :type, :text
add_column :submission_records, :content, :string
add_column :submission_records, :createdat, :datetime
add_column :submission_records, :operation, :string
add_column :submis... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/018_create_teams.rb | Ruby | mit | 191 | main | 495 | class CreateTeams < ActiveRecord::Migration[4.2]
def self.up
create_table 'teams', force: true do |t|
t.column 'name', :string
t.column 'assignment_id', :integer, default: 0, null: false
end
add_index 'teams', ['assignment_id'], name: 'fk_teams_assignments'
execute "alter table teams
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/088_update_custom.rb | Ruby | mit | 191 | main | 8,045 | class UpdateCustom < ActiveRecord::Migration[4.2]
def self.up
execute 'DELETE FROM `content_pages` where ID in (1,10)'
execute "INSERT INTO `content_pages` VALUES (1,'Home Page','home',1,'<h1>Welcome to Expertiza</h1> <p> The Expertiza project is a system for using peer review to create reusable learning obje... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/005_create_deadline_rights.rb | Ruby | mit | 191 | main | 325 | class CreateDeadlineRights < ActiveRecord::Migration[4.2]
def self.up
create_table 'deadline_rights', force: true do |t|
t.column 'name', :string, limit: 32
end
execute "INSERT INTO `deadline_rights` VALUES (1,'No'),(2,'Late'),(3,'OK');"
end
def self.down
drop_table 'deadline_rights'
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20150105163040_add_deadline_name_and_description_url_to_due_dates.rb | Ruby | mit | 191 | main | 331 | class AddDeadlineNameAndDescriptionUrlToDueDates < ActiveRecord::Migration[4.2]
def self.up
add_column 'due_dates', 'deadline_name', :string
add_column 'due_dates', 'description_url', :string
end
def self.down
remove_column 'due_dates', 'deadline_name'
remove_column 'due_dates', 'description_url'... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/085_update_controllers_teammate_review.rb | Ruby | mit | 191 | main | 1,036 | class UpdateControllersTeammateReview < ActiveRecord::Migration[4.2]
def self.up
perm = Permission.find_by_name('do assignments')
controller = SiteController.find_or_create_by(name: 'teammate_review')
controller.permission_id = perm.id
controller.save
ControllerAction.create(site_controller_id: c... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/069_move_files.rb | Ruby | mit | 191 | main | 2,151 | class MoveFiles < ActiveRecord::Migration[4.2]
def self.up
courses = Course.where(['not instructor_id is null'])
courses.each do |course|
if course.directory_path.nil?
course.directory_path = FileHelper.clean_path(course.name)
end
csplit = course.directory_path.split('/')
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20130606204315_rename_team_count_to_max_team_size.rb | Ruby | mit | 191 | main | 233 | class RenameTeamCountToMaxTeamSize < ActiveRecord::Migration[4.2]
def self.up
rename_column :assignments, :team_count, :max_team_size
end
def self.down
rename_column :assignments, :max_team_size, :team_count
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131112020534_add_quiz_question_type_quiz_questionnaire.rb | Ruby | mit | 191 | main | 242 | class AddQuizQuestionTypeQuizQuestionnaire < ActiveRecord::Migration[4.2]
def self.up
add_column :questionnaires, :quiz_question_type, :text
end
def self.down
delete_column :questionnaires, :quiz_question_type, :text
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/003_create_goldberg_users.rb | Ruby | mit | 191 | main | 943 | class CreateGoldbergUsers < ActiveRecord::Migration[4.2]
def self.up
create_table 'goldberg_users', force: true do |t|
t.column 'name', :string, default: '', null: false
t.column 'password', :string, limit: 40, default: '', null: false
t.column 'role_id', :integer, default: 0, null: false
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111130205809_add_microtask_flag_to_assignments.rb | Ruby | mit | 191 | main | 223 | class AddMicrotaskFlagToAssignments < ActiveRecord::Migration[4.2]
def self.up
add_column :assignments, :microtask, :boolean, default: false
end
def self.down
remove_column :assignments, :microtask
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20111025015938_drop_goldberg_tables.rb | Ruby | mit | 191 | main | 485 | class DropGoldbergTables < ActiveRecord::Migration[4.2]
def self.up
drop_table :goldberg_content_pages
drop_table :goldberg_controller_actions
drop_table :goldberg_markup_styles
drop_table :goldberg_menu_items
drop_table :goldberg_permissions
drop_table :goldberg_roles
drop_table :goldberg... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/043_update_review_of_review_mappings.rb | Ruby | mit | 191 | main | 568 | class UpdateReviewOfReviewMappings < ActiveRecord::Migration[4.2]
def self.up
begin
execute "ALTER TABLE `review_of_review_mappings`
DROP INDEX `fk_review_of_review_mapping_reviews`"
rescue StandardError
end
begin
execute "ALTER TABLE `review_of_review_mappings`
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20121019201555_create_automated_metareviews.rb | Ruby | mit | 191 | main | 763 | class CreateAutomatedMetareviews < ActiveRecord::Migration[4.2]
def self.up
create_table :automated_metareviews do |t|
t.float :relevance
t.float :content_summative
t.float :content_problem
t.float :content_advisory
t.float :tone_positive
t.float :tone_negative
t.float :t... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/122_create_suggestion_comments.rb | Ruby | mit | 191 | main | 385 | class CreateSuggestionComments < ActiveRecord::Migration[4.2]
def self.up
create_table :suggestion_comments do |t|
t.column :comments, :text
t.column :commenter, :string
t.column :vote, :string
t.column :suggestion_id, :int
t.column :created_at, :datetime
end
en... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/055_create_folder_nodes.rb | Ruby | mit | 191 | main | 550 | class CreateFolderNodes < ActiveRecord::Migration[4.2]
def self.up
add_column :nodes, :name, :string
add_column :nodes, :lft, :integer
add_column :nodes, :rgt, :integer
add_column :nodes, :depth, :integer
TreeFolder.find_each do |folder|
FolderNode.create(node_object_id: folder.id, parent_i... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20171018202650_create_tag_prompts.rb | Ruby | mit | 191 | main | 227 | class CreateTagPrompts < ActiveRecord::Migration[4.2]
def change
create_table :tag_prompts do |t|
t.string :prompt
t.string :desc
t.string :control_type
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20170110185019_remove_leaderboard_privary_from_users_table.rb | Ruby | mit | 191 | main | 240 | class RemoveLeaderboardPrivaryFromUsersTable < ActiveRecord::Migration[4.2]
def self.up
remove_column :users, :leaderboard_privacy
end
def self.down
add_column :users, :leaderboard_privacy, :boolean, default: false
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20131201172700_remove_late_policy_due_date.rb | Ruby | mit | 191 | main | 427 | class RemoveLatePolicyDueDate < ActiveRecord::Migration[4.2]
def self.up
execute 'ALTER TABLE due_dates DROP FOREIGN KEY `fk_due_date_late_policies`;'
remove_column :due_dates, :late_policy_id
end
def self.down
add_column :due_dates, :late_policy_id, :integer
execute 'ALTER TABLE due_dates ADD CO... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20211102232519_create_duties.rb | Ruby | mit | 191 | main | 261 | class CreateDuties < ActiveRecord::Migration[4.2]
def change
create_table :duties do |t|
t.string :name
t.integer :max_duty_limit
t.references :assignment, index: true, foreign_key: true
t.timestamps null: false
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/20260322130000_update_instructor_review_scores_for_formative_and_summative.rb | Ruby | mit | 191 | main | 412 | class UpdateInstructorReviewScoresForFormativeAndSummative < ActiveRecord::Migration[5.1]
def change
rename_column :instructor_review_scores, :score, :score_for_summative
rename_column :instructor_review_scores, :feedback, :feedback_for_formative
add_column :instructor_review_scores, :score_for_formative... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/119_create_topic_dependencies.rb | Ruby | mit | 191 | main | 294 | class CreateTopicDependencies < ActiveRecord::Migration[4.2]
def self.up
create_table :topic_dependencies do |t|
t.column :topic_id, :integer, null: false
t.column :dependent_on, :string, null: false
end
end
def self.down
drop_table :topic_dependencies
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | db/migrate/109_cleanup_assignment_indices.rb | Ruby | mit | 191 | main | 1,979 | class CleanupAssignmentIndices < ActiveRecord::Migration[4.2]
# add/remove indices and foreign keys when appropriate
def self.up
change_column :assignments, :course_id, :integer, null: true
change_column :assignments, :instructor_id, :integer, null: true
change_column :assignments, :review_strategy_id, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/scoring.rb | Ruby | mit | 191 | main | 18,177 | module Scoring
# Computes the total score for a *list of assessments*
# parameters
# assessments - a list of assessments of some type (e.g., author feedback, teammate review)
# questions - the list of questions that was filled out in the process of doing those assessments
# Called in: bookmarks_controller.r... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/hamer.rb | Ruby | mit | 191 | main | 4,048 | module Hamer
def self.calculate_weighted_scores_and_reputation(submissions, reviewers)
# Initialize weights
submissions.each { |s| s.reviews.each { |review| review.weight = 1 } }
# Iterate until convergence
iterations = 0
loop do
# Store previous weights to determine convergence
previ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/tasks/scrub_database.rake | Ruby | mit | 191 | main | 261 | namespace :db do
namespace :data do
desc 'Scrubs the database of user information'
task scrub: :environment do
# Require the data migration class
require './db/data_migrations/scrub_database.rb'
ScrubDatabase.run!
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/tasks/user_mapping.rake | Ruby | mit | 191 | main | 251 | namespace :db do
namespace :data do
desc 'Maps user ids to anonymous user ids'
task map: :environment do
# Require the data migration class
require './db/data_migrations/user_mapping.rb'
UserMapping.run!
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/tasks/data_migrate.rake | Ruby | mit | 191 | main | 262 | namespace :db do
namespace :data do
desc 'Performs all idempotent data migrations'
task migrate: :environment do
# Require the data migration class
require './db/data_migrations/data_migrations'
DataMigrations.run!
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/tasks/unity_mapping.rake | Ruby | mit | 191 | main | 259 | namespace :db do
namespace :data do
desc 'Maps user ids to anonymous user ids'
task unity_map: :environment do
# Require the data migration class
require './db/data_migrations/unity_mapping.rb'
UnityMapping.run!
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/tasks/db_diagram.rake | Ruby | mit | 191 | main | 671 | namespace :db do
desc 'Outputs the current database schema diagram to ./db'
task :diagram do
# Check SQLFairy dependency
sqlt_path = `which sqlt-graph`
exit 1 if sqlt_path.nil? || sqlt_path.empty?
begin
db_config = YAML.safe_load(File.new('config/database.yml').read)
db_pass = db_config... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | lib/capistrano/tasks/bower.rake | Ruby | mit | 191 | main | 334 | namespace :bower do
desc 'Install bower dependencies'
task :install do
on roles(:web) do
within release_path do
execute :bower, 'install', '--allow-root',
"--config.directory=#{shared_path}/vendor/assets/components"
end
end
end
end
before 'deploy:assets:precompile', 'b... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/advice_controller.rb | Ruby | mit | 191 | main | 3,533 | class AdviceController < ApplicationController
# Advice_controller first checks whether current user has TA privileges or not by implementing action_allowed? method. Secondly it sets the number of advices based on score and sort it in descending order. Then it checks four conditions for the advices.
# 1. If number ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/teams_users_controller.rb | Ruby | mit | 191 | main | 4,637 | class TeamsUsersController < ApplicationController
include AuthorizationHelper
def action_allowed?
# Allow duty updation for a team if current user is student, else require TA or above Privileges.
if %w[update_duties].include? params[:action]
current_user_has_student_privileges?
else
curren... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/tag_prompts_controller.rb | Ruby | mit | 191 | main | 1,333 | class TagPromptsController < ApplicationController
skip_before_action :verify_authenticity_token
def action_allowed?
true
end
# GET /tag_prompts/view
def show
@popup = false
if params.key?(:popup) && params[:popup].to_s.casecmp('true').zero?
@popup = true
render layout: false
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/pair_programming_controller.rb | Ruby | mit | 191 | main | 1,418 | class PairProgrammingController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_student_privileges?
end
def send_invitations
users = TeamsUser.where(team_id: params[:team_id])
users.each { |user| user.update_attributes(pair_programming_status: "W") }
Te... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/quiz_questionnaires_controller.rb | Ruby | mit | 191 | main | 12,909 | class QuizQuestionnairesController < QuestionnairesController
include AuthorizationHelper
# Quiz questionnaire edit option to be allowed for student
def action_allowed?
if params[:action] == 'edit'
@questionnaire = Questionnaire.find(params[:id])
current_user_has_admin_privileges? || current_user... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/export_file_controller.rb | Ruby | mit | 191 | main | 4,501 | class ExportFileController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_ta_privileges?
end
# Assign titles to model for display
def start
@model = params[:model]
titles = { 'Assignment' => 'Grades', 'CourseParticipant' => 'Course Participants', 'Assign... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/join_team_requests_controller.rb | Ruby | mit | 191 | main | 3,400 | # frozen_string_literal: true
class JoinTeamRequestsController < ApplicationController
include AuthorizationHelper
before_action :check_team_status, only: [:create]
before_action :find_request, only: %i[show edit update destroy decline]
def action_allowed?
current_user_has_student_privileges?
end
de... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/publishing_controller.rb | Ruby | mit | 191 | main | 2,148 | class PublishingController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_student_privileges?
end
def view
@user = User.find(session[:user].id) # Find again, because the user's certificate may have changed since login
@participants = AssignmentParticipant.... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/application_controller.rb | Ruby | mit | 191 | main | 5,577 | class ApplicationController < ActionController::Base
include AccessHelper
helper_method :current_user
# You want to get exceptions in development, but not in production.
unless Rails.application.config.consider_all_requests_local
rescue_from ActionView::MissingTemplate do |_exception|
redirect_to roo... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/suggestion_controller.rb | Ruby | mit | 191 | main | 6,182 | class SuggestionController < ApplicationController
include AuthorizationHelper
def action_allowed?
case params[:action]
when 'create', 'new', 'student_view', 'student_edit', 'update_suggestion', 'submit'
current_user_has_student_privileges?
else
current_user_has_ta_privileges?
end
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/content_pages_controller.rb | Ruby | mit | 191 | main | 3,094 | class ContentPagesController < ApplicationController
include AuthorizationHelper
# Currently, this controller is only used for managing pull-down menus.
# Further development is currently paused on this controller, please consult before changing/using the code.
# GETs should be safe (see http://www.w3.org/2001... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/sign_up_sheet_controller.rb | Ruby | mit | 191 | main | 26,082 | # contains all functions related to management of the signup sheet for an assignment
# functions to add new topics to an assignment, edit properties of a particular topic, delete a topic, etc
# are included here
# A point to be taken into consideration is that :id (except when explicitly stated) here means topic id an... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/reports_controller.rb | Ruby | mit | 191 | main | 7,407 | class ReportsController < ApplicationController
include AuthorizationHelper
autocomplete :user, :name
helper :submitted_content
include ReportFormatterHelper
# reports are allowed to be viewed by only by TA, instructor and administrator
def action_allowed?
current_user_has_ta_privileges?
end
def... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/admin_controller.rb | Ruby | mit | 191 | main | 1,072 | class AdminController < ApplicationController
include AuthorizationHelper
def action_allowed?
case params[:action]
when 'list_instructors'
current_user_has_admin_privileges?
when 'remove_instructor'
current_user_has_admin_privileges?
else
current_user_has_super_admin_privileges?
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/submitted_content_controller.rb | Ruby | mit | 191 | main | 12,738 | class SubmittedContentController < ApplicationController
require 'mimemagic'
require 'mimemagic/overlay'
include AuthorizationHelper
def action_allowed?
case params[:action]
when 'edit'
current_user_has_student_privileges? &&
are_needed_authorizations_present?(params[:id], 'reader', 'rev... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/participants_controller.rb | Ruby | mit | 191 | main | 10,024 | class ParticipantsController < ApplicationController
include AuthorizationHelper
include ParticipantsHelper
autocomplete :user, :name
def action_allowed?
if %w[change_handle update_duties].include? params[:action]
current_user_has_student_privileges?
else
current_user_has_ta_privileges?
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/student_view_controller.rb | Ruby | mit | 191 | main | 682 | class StudentViewController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_instructor_privileges?
end
def flip_view
# flips the value of session[:flip_user], allowing an instructor
# to see the student view, or allows them to switch back, due to
# chec... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/controller_actions_controller.rb | Ruby | mit | 191 | main | 3,184 | class ControllerActionsController < ApplicationController
include AuthorizationHelper
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to: { action: :index }
def action_allowed?
current_user_has_super_admi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/student_task_controller.rb | Ruby | mit | 191 | main | 5,811 | class StudentTaskController < ApplicationController
include AuthorizationHelper
helper :submitted_content
def action_allowed?
current_user_has_student_privileges?
end
def impersonating_as_admin?
original_user = session[:original_user]
admin_role_ids = Role.where(name: %w[Administrator Super-Adm... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/profile_controller.rb | Ruby | mit | 191 | main | 1,922 | class ProfileController < ApplicationController
include AuthorizationHelper
def action_allowed?
user_logged_in?
end
def edit
@user = session[:user]
@assignment_questionnaire = AssignmentQuestionnaire.where('user_id = ? and assignment_id is null and questionnaire_id is null', @user.id).first
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/user_pastebins_controller.rb | Ruby | mit | 191 | main | 1,797 | # frozen_string_literal: true
class UserPastebinsController < ApplicationController
include AuthorizationHelper
before_action :set_user_pastebin, only: %i[show edit update destroy]
def action_allowed?
case params[:action]
when 'index', 'create'
current_user_has_student_privileges?
end
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/questions_controller.rb | Ruby | mit | 191 | main | 5,292 | class QuestionsController < ApplicationController
include AuthorizationHelper
# A question is a single entry within a questionnaire
# Questions provide a way of scoring an object
# based on either a numeric value or a true/false
# state.
# Default action, same as list
def index
list
render actio... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/users_controller.rb | Ruby | mit | 191 | main | 10,468 | require 'will_paginate/array'
class UsersController < ApplicationController
include AuthorizationHelper
include ConferenceHelper
autocomplete :user, :name
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to:... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/menu_items_controller.rb | Ruby | mit | 191 | main | 4,502 | require 'menu'
class MenuItemsController < ApplicationController
def action_allowed?
case params[:action]
when 'link'
true
end
end
def index
list
render action: 'list'
end
def list
# @menu_item_pages, @menu_items = paginate :menu_items, :per_page => 10
@settings = SystemSe... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/student_quizzes_controller.rb | Ruby | mit | 191 | main | 5,338 | class StudentQuizzesController < ApplicationController
include AuthorizationHelper
def action_allowed?
if current_user_is_a? 'Student'
if action_name.eql? 'index'
are_needed_authorizations_present?(params[:id], 'reviewer', 'submitter')
else
true
end
else
current_user... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/lock_controller.rb | Ruby | mit | 191 | main | 1,023 | # A controller for interacting with locks from view classes
# The reason this was added was to ensure that a lock was released when a user left the page for
# review responses. See app/views/response/response.html.erb
class LockController < ApplicationController
def action_allowed?
case params[:action]
when '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/submission_records_controller.rb | Ruby | mit | 191 | main | 863 | class SubmissionRecordsController < ApplicationController
include AuthorizationHelper
before_action :set_submission_record, only: %i[show edit update destroy]
def action_allowed?
# currently we only have a index method which shows all the submission records given a team_id
assignment_team = AssignmentTe... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/badges_controller.rb | Ruby | mit | 191 | main | 1,191 | # added the badges controller as part of E1822
# added a create method for badge creation functionality
class BadgesController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_ta_privileges?
end
def new
@badge = Badge.new
session[:return_to] ||= request.refe... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/lti_controller.rb | Ruby | mit | 191 | main | 2,721 | # app/controllers/lti_controller.rb
class LtiController < ApplicationController
include AuthHelper # This gives access to AuthController methods
protect_from_forgery with: :exception, except: [:launch]
skip_before_action :authorize, only: [:launch]
after_action :allow_iframe, only: [:launch]
def launch
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/institution_controller.rb | Ruby | mit | 191 | main | 1,411 | class InstitutionController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_instructor_privileges?
end
def index
list
render action: 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/track_notifications_controller.rb | Ruby | mit | 191 | main | 742 | class TrackNotificationsController < ApplicationController
include AuthorizationHelper
# Give permission to manage notifications to appropriate roles
def action_allowed?
current_user_has_student_privileges?
end
# GET /track_notifications *** Only used to add an individual exemption to showing notificati... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/invitations_controller.rb | Ruby | mit | 191 | main | 6,204 | class InvitationsController < ApplicationController
include AuthorizationHelper
include ConferenceHelper
before_action :check_user_before_invitation, only: [:create]
before_action :check_team_before_accept, only: [:accept]
def action_allowed?
current_user_has_student_privileges?
end
def new
@in... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/answer_tags_controller.rb | Ruby | mit | 191 | main | 1,473 | class AnswerTagsController < ApplicationController
include AuthorizationHelper
protect_from_forgery with: :null_session
skip_before_action :verify_authenticity_token
def action_allowed?
case params[:action]
when 'index', 'create_edit'
current_user_has_student_privileges?
end
end
# GET /... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/import_file_controller.rb | Ruby | mit | 191 | main | 11,335 | class ImportFileController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_ta_privileges?
end
def show
@id = params[:id]
@model = params[:model]
@options = params[:options]
@delimiter = get_delimiter(params)
@has_header = params[:has_header]
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/questionnaires_controller.rb | Ruby | mit | 191 | main | 11,883 | class QuestionnairesController < ApplicationController
include AuthorizationHelper
before_action [:create_questionnaire, :save], only: [:list]
include QuestionnaireHelper
include QuestionHelper
# Controller for Questionnaire objects
# A Questionnaire can be of several types (QuestionnaireType)
# Each Qu... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/assignments_controller.rb | Ruby | mit | 191 | main | 21,787 | class AssignmentsController < ApplicationController
include AssignmentHelper
include AuthorizationHelper
autocomplete :user, :name
before_action :authorize
# determines if an action is allowed for a user
def action_allowed?
if %w[edit update list_submissions].include? params[:action]
current_user... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/bookmarks_controller.rb | Ruby | mit | 191 | main | 5,146 | class BookmarksController < ApplicationController
include AuthorizationHelper
include Scoring
helper_method :specific_average_score
helper_method :total_average_score
def action_allowed?
case params[:action]
when 'list'
current_role_name =~ /^(Student|Instructor|Teaching Assistant)$/
when '... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/account_request_controller.rb | Ruby | mit | 191 | main | 7,866 | class AccountRequestController < ApplicationController
include AuthorizationHelper
autocomplete :user, :name
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to: { action: :list }
def action_allowed?
case... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/reputation_web_service_controller.rb | Ruby | mit | 191 | main | 17,688 | require 'json'
require 'uri'
require 'net/http'
require 'openssl'
require 'base64'
# Expertiza allows student work to be peer-reviewed, since peers can provide
# more feedback than the instructor can.
# However, if we want to assure that all students receive competent feedback,
# or even use peer-assigned grades,
# we... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/plagiarism_checker_comparison_controller.rb | Ruby | mit | 191 | main | 454 | class PlagiarismCheckerComparisonController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:save_results]
skip_before_action :authorize, only: [:save_results]
def index; end
def save_results
assignment_submission_id = params[:id]
threshold = Assignment.find(params[:id]).... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/notifications_controller.rb | Ruby | mit | 191 | main | 2,172 | class NotificationsController < ApplicationController
before_action :set_notification, only: %i[show edit update destroy]
helper_method :validate_params
include SecurityHelper
include AuthorizationHelper
# Give permission to manage notifications to appropriate roles
def action_allowed?
current_user_ha... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/courses_controller.rb | Ruby | mit | 191 | main | 5,674 | # Provides Course functions
# Author: unknown
#
# Last modified: 7/18/2008
# By: ajbudlon
# change access permission from public to private or vice versa
class CoursesController < ApplicationController
include AuthorizationHelper
autocomplete :user, :name
require 'fileutils'
def action_allowed?
current_u... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/lottery_controller.rb | Ruby | mit | 191 | main | 6,860 | class LotteryController < ApplicationController
include AuthorizationHelper
require 'json'
require 'rest_client'
# Give permission to run the bid to appropriate roles
def action_allowed?
current_user_has_ta_privileges?
end
# This method sends a request to a web service that uses k-means and student... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/site_controllers_controller.rb | Ruby | mit | 191 | main | 3,386 | class SiteControllersController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_super_admin_privileges?
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to: {... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/response_controller.rb | Ruby | mit | 191 | main | 19,269 | class ResponseController < ApplicationController
include AuthorizationHelper
include ResponseHelper
helper :submitted_content
helper :file
before_action :authorize_show_calibration_results, only: %i[show_calibration_results_for_student]
before_action :set_response, only: %i[update delete view detailed_eva... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/student_teams_controller.rb | Ruby | mit | 191 | main | 7,127 | class StudentTeamsController < ApplicationController
include AuthorizationHelper
autocomplete :user, :name
def team
@team ||= AssignmentTeam.find params[:team_id]
end
attr_writer :team
def student
@student ||= AssignmentParticipant.find(params[:student_id])
end
attr_writer :student
befor... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/markup_styles_controller.rb | Ruby | mit | 191 | main | 1,439 | class MarkupStylesController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_super_admin_privileges?
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to: { ac... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/system_settings_controller.rb | Ruby | mit | 191 | main | 2,203 | class SystemSettingsController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_super_admin_privileges?
end
def index
list
render action: 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, onl... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/advertise_for_partner_controller.rb | Ruby | mit | 191 | main | 3,234 | class AdvertiseForPartnerController < ApplicationController
include AuthorizationHelper
def action_allowed?
# Any user with at least a Student role should be able to advertise for a partner
# For the create, edit, update, and remove actions the current user should also be a participant in the assignment
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/late_policies_controller.rb | Ruby | mit | 191 | main | 7,055 | # A controller for interacting with late policies from view classes.
# The reason this was added was to perform CRUD operations on late policies.
# See app/views/late_policies.
class LatePoliciesController < ApplicationController
include AuthorizationHelper
# This method checks the privileges of the current user t... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/grades_controller.rb | Ruby | mit | 191 | main | 10,714 | class GradesController < ApplicationController
helper :file
helper :submitted_content
helper :penalty
include PenaltyHelper
include StudentTaskHelper
include AssignmentHelper
include GradesHelper
include AuthorizationHelper
include Scoring
def action_allowed?
case params[:action]
when 'view... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/student_review_controller.rb | Ruby | mit | 191 | main | 3,179 | class StudentReviewController < ApplicationController
include AuthorizationHelper
def action_allowed?
(current_user_has_student_privileges? &&
(%w[list].include? action_name) &&
are_needed_authorizations_present?(params[:id], 'submitter')) ||
current_user_has_student_privileges?
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/impersonate_controller.rb | Ruby | mit | 191 | main | 6,635 | # Controller for performing Impersonate Operation in Expertiza
class ImpersonateController < ApplicationController
include SecurityHelper
# This function checks if the logged in user is a student or not.
# If it is a student, do not allow the impersonate mode.
# If the logged in user has the role or anything ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/auth_controller.rb | Ruby | mit | 191 | main | 3,150 | class AuthController < ApplicationController
include AuthorizationHelper
helper :auth
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[login logout],
redirect_to: { action: :list }
def action_allowed?
case params[:action]
when 'logi... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/eula_controller.rb | Ruby | mit | 191 | main | 444 | class EulaController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_student_privileges?
end
def display; end
def accept
session[:user].update_attribute('is_new_user', 0)
redirect_to controller: 'student_task', action: 'list'
end
def decline
fla... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/sample_reviews_controller.rb | Ruby | mit | 191 | main | 2,334 | class SampleReviewsController < ApplicationController
def action_allowed?
['Instructor',
'Teaching Assistant',
'Administrator',
'Super-Administrator',
'Student'].include?(current_role_name) &&
((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'submitter')... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/password_retrieval_controller.rb | Ruby | mit | 191 | main | 4,251 | class PasswordRetrievalController < ApplicationController
def action_allowed?
true
end
def forgotten
render template: 'password_retrieval/forgotten'
end
def send_password
if params[:user][:email].nil? || params[:user][:email].strip.empty?
flash[:error] = 'Please enter an e-mail address.'
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/conference_controller.rb | Ruby | mit | 191 | main | 2,707 | class ConferenceController < ApplicationController
include AuthorizationHelper
include ConferenceHelper
autocomplete :user, :name
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify method: :post, only: %i[destroy create update],
redirect_to: { action: :list }
def a... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/versions_controller.rb | Ruby | mit | 191 | main | 1,517 | class VersionsController < ApplicationController
include AuthorizationHelper
def action_allowed?
current_user_has_admin_privileges?
end
def index
redirect_to '/versions/search'
end
def show
@version = Version.find_by(id: params[:id])
end
def search
@per_page = params[:num_versions]
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/assessment360_controller.rb | Ruby | mit | 191 | main | 9,803 | class Assessment360Controller < ApplicationController
include GradesHelper
include AuthorizationHelper
include Scoring
include PenaltyHelper
# Added the @instructor to display the instructor name in the home page of the 360 degree assessment
def action_allowed?
current_user_has_ta_privileges?
end
#... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/controllers/popup_controller.rb | Ruby | mit | 191 | main | 6,997 | class PopupController < ApplicationController
include StringOperationHelper
include AuthorizationHelper
ASSIGNMENT_NAME_SIMILARITY_THRESHOLD = 0.50
def action_allowed?
current_user_has_ta_privileges?
end
# this can be called from "response_report" by clicking student names from instructor end.
def a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.