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 | app/models/node.rb | Ruby | mit | 191 | main | 1,436 | # Base Node class
# Provides common method definitions, but minimal functoinality.
# Must be subclassed for use in tree_display code
#
# Author: AJBUDLON
# Date: 7/18/2008
class Node < ApplicationRecord
has_paper_trail
# acts_as_nested_set
belongs_to :parent, class_name: 'Node', foreign_key: 'parent_id', inverse... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/questionnaire_type_node.rb | Ruby | mit | 191 | main | 959 | class QuestionnaireTypeNode < FolderNode
belongs_to :table, class_name: 'TreeFolder', foreign_key: 'node_object_id', inverse_of: false
belongs_to :node_object, class_name: 'TreeFolder', inverse_of: false
def self.table
'tree_folders'
end
def self.get(_sortvar = nil, _sortorder = nil, _user_id = nil, _sh... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/vm_user_answer_tagging.rb | Ruby | mit | 191 | main | 557 | class VmUserAnswerTagging
def initialize(user, percentage, no_tagged, no_not_tagged, no_tagable, tag_update_intervals)
@user = user
@percentage = percentage
@no_tagged = no_tagged
@no_not_tagged = no_not_tagged
@no_tagable = no_tagable
# E2082 Adding interval to be passed for graph plotting
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/course.rb | Ruby | mit | 191 | main | 2,760 | class Course < ApplicationRecord
enum locale: Locale.code_name_to_db_encoding
has_many :ta_mappings, dependent: :destroy
has_many :tas, through: :ta_mappings
has_many :assignments, dependent: :destroy
belongs_to :instructor, class_name: 'User', foreign_key: 'instructor_id'
belongs_to :institution, foreign_k... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/metareview_questionnaire.rb | Ruby | mit | 191 | main | 365 | class MetareviewQuestionnaire < Questionnaire
after_initialize :post_initialization
@print_name = 'Metareview Rubric'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Metareview'
end
def symbol
'metareview'.to_sym
end
def get_assessments_for(partic... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/questionnaire_header.rb | Ruby | mit | 191 | main | 1,434 | class QuestionnaireHeader < Question
# This method returns what to display if an instructor (etc.) is creating or editing a questionnaire (questionnaires_controller.rb)
def edit(_count)
html = '<tr>'
html += '<td align="center"><a rel="nofollow" data-method="delete" href="/questions/' + id.to_s + '">Remove<... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/rubric.rb | Ruby | mit | 191 | main | 669 | # This is one type of Questionnaire and as intuitively expected this model class
# derives from Questionnaire.
# This implements Rubric(type) specific model methods ( Rubric does not have any type specific
# functionality). These methods are invoked when called by any activeRecord object(row) of
# questionnaires tabl... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/authority.rb | Ruby | mit | 191 | main | 276 | class Authority
attr_reader :current_user
def initialize(args = {})
@current_user = args[:current_user]
end
def allow?(controller, _action)
return true if current_user && current_user.admin?
case controller
when 'pages'
true
end
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/scored_question.rb | Ruby | mit | 191 | main | 448 | class ScoredQuestion < ChoiceQuestion
validates :weight, presence: true # user must specify a weight for a question
validates :weight, numericality: true # the weight must be numeric
def edit; end
def view_question_text; end
def complete; end
def view_completed_question; end
def self.compute_question... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/sign_up_sheet.rb | Ruby | mit | 191 | main | 4,472 | class SignUpSheet < ApplicationRecord
# Team lazy initialization method [zhewei, 06/27/2015]
def self.signup_team(assignment_id, user_id, topic_id = nil)
# Find the team ID for the given assignment and user
team_id = Team.find_team_users(assignment_id, user_id)&.first&.t_id
# If the team doesn't exist, ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/bookmark.rb | Ruby | mit | 191 | main | 216 | class Bookmark < ApplicationRecord
belongs_to :user
belongs_to :topic
has_many :bookmark_ratings
validates :url, presence: true
validates :title, presence: true
validates :description, presence: true
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/upload_file.rb | Ruby | mit | 191 | main | 1,576 | class UploadFile < Question
# This method returns what to display if an instructor (etc.) is creating or editing a questionnaire (questionnaires_controller.rb)
def edit(_count)
html = '<tr>'
html += '<td align="center"><a rel="nofollow" data-method="delete" href="/questions/' + id.to_s + '">Remove</a></td>'... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/submission_content_fetcher.rb | Ruby | mit | 191 | main | 590 | class SubmissionContentFetcher
class << self
def doc_factory(url)
params = { 'url' => url }
if GoogleDocFetcher.supports_url?(url)
return GoogleDocFetcher.new(params)
elsif WebsiteFetcher.supports_url?(url) # leave last as catch-all
return WebsiteFetcher.new(params)
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/bookmark_rating_response_map.rb | Ruby | mit | 191 | main | 541 | class BookmarkRatingResponseMap < ReviewResponseMap
belongs_to :reviewee, class_name: 'Bookmark', foreign_key: 'reviewee_id'
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'
def questionnaire
assignment.questionnaires.find_by(type: 'BookmarkRatingQuestionnaire')
end
de... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/global_survey_response_map.rb | Ruby | mit | 191 | main | 514 | class GlobalSurveyResponseMap < SurveyResponseMap
belongs_to :survey_deployment, class_name: 'SurveyDeployment', foreign_key: 'reviewee_id'
belongs_to :questionnaire, class_name: 'Questionnaire', foreign_key: 'reviewed_object_id'
belongs_to :reviewer, class_name: 'Participant', foreign_key: 'reviewer_id'
def q... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/waitlist.rb | Ruby | mit | 191 | main | 870 | class Waitlist < ApplicationRecord
def self.cancel_all_waitlists(team_id, assignment_id)
waitlisted_topics = SignUpTopic.find_waitlisted_topics_for_team(assignment_id, team_id)
if not waitlisted_topics.nil?
SignedUpTeam.destroy(waitlisted_topics.map(&:id))
end
end
def self.remove_from_waitlists(team_id)
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/assignment_survey_response_map.rb | Ruby | mit | 191 | main | 529 | class AssignmentSurveyResponseMap < SurveyResponseMap
belongs_to :survey_deployment, class_name: 'SurveyDeployment', foreign_key: 'reviewee_id'
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'
belongs_to :reviewer, class_name: 'Participant', foreign_key: 'reviewer_id'
def que... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/rscore.rb | Ruby | mit | 191 | main | 730 | class Rscore
attr_accessor :my_max, :my_min, :my_avg, :my_type
# def initialize(max = 0.0, min = 0.0, avg = 0.0, type = nil)
# @my_max = max == -1 ? "N/A" : max
# @my_min = min == -1 ? "N/A" : min
# @my_avg = avg == -1 ? "N/A" : avg
# @my_type = type
# end
def initialize(my_score, type)
@my... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/vm_question_response_score_cell.rb | Ruby | mit | 191 | main | 383 | # represents each score cell of the heatgrid table.
class VmQuestionResponseScoreCell
def initialize(score_value, color_code, comments, vmprompts = nil)
@score_value = score_value
@color_code = color_code
@comment = comments
@vm_prompts = vmprompts
end
attr_reader :score_value
attr_reader :com... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/assignment_participant.rb | Ruby | mit | 191 | main | 7,621 | require 'uri'
require 'yaml'
# Code Review: Notice that Participant overloads two different concepts:
# contribution and participant (see fields of the participant table).
# Consider creating a new table called contributions.
#
# Alias methods exist in this class which append 'get_' to many me... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/password_reset.rb | Ruby | mit | 191 | main | 446 | class PasswordReset < ApplicationRecord
validates :user_email, presence: true
# attr_accessible :user_email, :token
def self.save_token(user, token)
password_reset = PasswordReset.find_by(user_email: user.email)
if password_reset
password_reset.token = Digest::SHA1.hexdigest(token)
password_re... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/checkbox.rb | Ruby | mit | 191 | main | 5,199 | class Checkbox < UnscoredQuestion
include ActionView::Helpers
# This method returns what to display if an instructor (etc.) is creating or editing a questionnaire (questionnaires_controller.rb)
def edit(count)
html = edit_remove_button(count) + edit_seq(count) + edit_question(count)
html += edit_type(coun... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/late_policy.rb | Ruby | mit | 191 | main | 2,419 | class LatePolicy < ApplicationRecord
belongs_to :user
# has_many :assignments
has_many :assignments, dependent: :nullify
validates :policy_name, presence: true
validates :instructor_id, presence: true
validates :max_penalty, presence: true
validates :penalty_per_unit, presence: true
validates :penalty... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/github_pull_request_fetcher.rb | Ruby | mit | 191 | main | 507 | class GithubPullRequestFetcher
require 'http_request'
class << self
def supports_url?(url)
lower_case_url = url.downcase
(HttpRequest.valid_url?(url) &&
(lower_case_url.include? 'github') &&
!%r{/pull/[0-9]+$}.match(lower_case_url).nil?)
end
end
def initialize(params)
@ur... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/quiz_question.rb | Ruby | mit | 191 | main | 741 | class QuizQuestion < Question
has_many :quiz_question_choices, class_name: 'QuizQuestionChoice', foreign_key: 'question_id', inverse_of: false, dependent: :nullify
def edit; end
def view_question_text
html = '<b>' + txt + '</b><br />'
html += 'Question Type: ' + type + '<br />'
html += 'Question Weig... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/menu.rb | Ruby | mit | 191 | main | 3,202 | class Menu
class Node
attr_accessor :parent, :parent_id, :children
attr_accessor :site_controller_id, :controller_action_id, :content_page_id
attr_accessor :id, :name, :label, :url
def initialize
@parent = nil
end
def setup(item)
@parent_id = item.parent_id
@name = item.nam... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/review_response_map.rb | Ruby | mit | 191 | main | 10,384 | class ReviewResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Team', foreign_key: 'reviewee_id', inverse_of: false
belongs_to :contributor, class_name: 'Team', foreign_key: 'reviewee_id', inverse_of: false
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id', inverse_of: ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/column_header.rb | Ruby | mit | 191 | main | 325 | class ColumnHeader < QuestionnaireHeader
def complete(_count, _answer = nil)
html = '<tr>'
html += '<th style="width: 15%">' + txt + '</th>'
html.html_safe
end
def view_completed_question(_count, _answer)
html = '<tr>'
html += '<th style="width: 15%">' + txt + '</th>'
html.html_safe
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/review_questionnaire.rb | Ruby | mit | 191 | main | 1,144 | class ReviewQuestionnaire < Questionnaire
after_initialize :post_initialization
@print_name = 'Review Rubric'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Review'
end
def symbol
'review'.to_sym
end
def get_assessments_for(participant)
parti... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/deadline_right.rb | Ruby | mit | 191 | main | 874 | class DeadlineRight < ApplicationRecord
NO = 1
LATE = 2
OK = 3
DEFAULT_PERMISSION = {
'signup' => {
'submission_allowed' => OK,
'can_review' => NO,
'review_of_review_allowed' => NO
},
'team_formation' => {
'submission_allowed' => OK,
'can_review' => NO,
'review_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/credentials.rb | Ruby | mit | 191 | main | 371 | class Credentials
attr_accessor :role_id, :updated_at, :role_ids
attr_accessor :permission_ids
attr_accessor :controllers, :actions, :pages
# Create a new credentials object for the given role
def initialize(role_id)
@role_id = role_id
role = Role.find(@role_id)
@updated_at = role.updated_at
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/ta.rb | Ruby | mit | 191 | main | 4,456 | class Ta < User
has_many :ta_mappings, dependent: :destroy
QUESTIONNAIRE = [['My questionnaires', 'list_mine'],
['All public questionnaires', 'list_all']].freeze
ASSIGNMENT = [['My assignments', 'list_mine'],
['All public assignments', 'list_all']].freeze
def courses_assist... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/teammate_review_response_map.rb | Ruby | mit | 191 | main | 1,503 | class TeammateReviewResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'
def questionnaire
assignment.questionnaires.find_by(type: 'TeammateReviewQuestionnaire')
end
# E21... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/survey_deployment.rb | Ruby | mit | 191 | main | 871 | class SurveyDeployment < ApplicationRecord
validates :start_date, presence: true
validates :end_date, presence: true
validate :valid_start_end_time?
def valid_start_end_time?
if end_date.nil? || start_date.nil?
errors[:base] << 'The start and end time should be specified.'
return false
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/criterion.rb | Ruby | mit | 191 | main | 10,262 | # Initial commit
class Criterion < ScoredQuestion
include ActionView::Helpers
validates :size, presence: true
# This method returns what to display if an instructor (etc.) is creating or editing a questionnaire (questionnaires_controller.rb)
def edit(_count)
html = '<td align="center"><a rel="nofollow" dat... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/metareview_response_map.rb | Ruby | mit | 191 | main | 4,161 | class MetareviewResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'
belongs_to :review_mapping, class_name: 'ResponseMap', foreign_key: 'reviewed_object_id'
delegate :assignment, to: :reviewee
# return all the versions available for a response map.
# a person... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/section_header.rb | Ruby | mit | 191 | main | 342 | class SectionHeader < QuestionnaireHeader
def complete(_count, _answer = nil)
html = '<b style="color: #986633; font-size: x-large">' + txt + '</b><br/><br/>'
html.html_safe
end
def view_completed_question(_count, _answer)
html = '<b style="color: #986633; font-size: x-large">' + txt + '</b>'
htm... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/account_request.rb | Ruby | mit | 191 | main | 626 | class AccountRequest < ApplicationRecord
before_save { self.email = email.downcase }
before_save { name }
validates :name, presence: true, length: { maximum: 50, message: 'is too long' }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i.freeze
validates :email, presence: true, length: { maximum: 255, m... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/bookmark_rating_questionnaire.rb | Ruby | mit | 191 | main | 382 | class BookmarkRatingQuestionnaire < Questionnaire
after_initialize :post_initialization
@print_name = 'Bookmark Rating Rubric'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Bookmark Rating'
end
def symbol
'bookmark'.to_sym
end
def get_assessment... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/course_survey_deployment.rb | Ruby | mit | 191 | main | 240 | class CourseSurveyDeployment < SurveyDeployment
belongs_to :course, class_name: 'Course', foreign_key: 'parent_id'
def parent_name
course.name
end
def response_maps
CourseSurveyResponseMap.where(reviewee_id: id)
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/due_date.rb | Ruby | mit | 191 | main | 4,293 | class DueDate < ApplicationRecord
validate :due_at_is_valid_datetime
# has_paper_trail
def self.default_permission(deadline_type, permission_type)
DeadlineRight::DEFAULT_PERMISSION[deadline_type][permission_type]
end
def self.current_due_date(due_dates)
# Get the current due date from list of due d... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/student_task.rb | Ruby | mit | 191 | main | 5,693 | # Author: Andrew Kofink, 2013-09-28
class StudentTask
attr_accessor :assignment, :current_stage, :participant, :stage_deadline, :topic
def initialize(args)
@assignment = args[:assignment]
@current_stage = args[:current_stage]
@participant = args[:participant]
@stage_deadline = args[:stage_deadline]... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/quiz_response.rb | Ruby | mit | 191 | main | 321 | class QuizResponse < Response
belongs_to :assignment
belongs_to :questionnaire
belongs_to :question
belongs_to :participant
belongs_to :response_map, foreign_key: :map_id, inverse_of: false
belongs_to :quiz_response_map, foreign_key: :map_id, inverse_of: false
# validates :response, :presence => true
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/folder_node.rb | Ruby | mit | 191 | main | 907 | class FolderNode < Node
belongs_to :folder, class_name: 'TreeFolder', foreign_key: 'node_object_id'
belongs_to :node_object, class_name: 'TreeFolder'
def self.get(_sortvar = nil, _sortorder = nil, _user_id = nil, _show = nil, _parent_id = nil, _search = nil)
joins(:folder).where('type = ? and tree_folders.pa... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/plagiarism_checker_assignment_submission.rb | Ruby | mit | 191 | main | 324 | class PlagiarismCheckerAssignmentSubmission < ApplicationRecord
# attr_accessible :name
belongs_to :assignment
has_many :plagiarism_checker_comparisons, dependent: :destroy
# t.string :name
validates :name, presence: true
# t.string :simicheck_id
validates :simicheck_id, presence: true, uniqueness: true
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/answer.rb | Ruby | mit | 191 | main | 2,246 | require 'analytic/score_analytic'
class Answer < ApplicationRecord
include ScoreAnalytic
belongs_to :question
belongs_to :response
def self.answers_by_question_for_reviewee_in_round(assignment_id, reviewee_id, q_id, round)
# get all answers to this question
question_answer = Answer.select(:answer, :c... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/user.rb | Ruby | mit | 191 | main | 11,309 | class User < ApplicationRecord
enum locale: Locale.code_name_to_db_encoding(Locale.available_locale_preferences)
acts_as_authentic do |config|
config.validates_uniqueness_of_email_field_options = { if: -> { false } } # Don't validate email uniqueness
config.crypto_provider = Authlogic::CryptoProviders::Sha1... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/assignment_survey_questionnaire.rb | Ruby | mit | 191 | main | 266 | class AssignmentSurveyQuestionnaire < SurveyQuestionnaire
after_initialize :post_initialization
@print_name = 'Assignment Survey'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Assignment Survey'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/course_survey_questionnaire.rb | Ruby | mit | 191 | main | 255 | class CourseSurveyQuestionnaire < SurveyQuestionnaire
after_initialize :post_initialization
@print_name = 'Course Survey'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Course Survey'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/text_field.rb | Ruby | mit | 191 | main | 1,174 | class TextField < TextResponse
def complete(count, answer = nil)
html = '<p style="width: 80%;">'
html += '<label for="responses_' + count.to_s + '" >' + txt + ' </label>'
html += '<input id="responses_' + count.to_s + '_score" name="responses[' + count.to_s + '][score]" type="hidden" value="" ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/notification.rb | Ruby | mit | 191 | main | 240 | class Notification < ApplicationRecord
validates :subject, presence: true
validates :description, presence: true
validates :expiration_date, presence: true
belongs_to :course
has_many :track_notifications, dependent: :destroy
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/content_page.rb | Ruby | mit | 191 | main | 1,083 | require 'redcloth'
class ContentPage < ApplicationRecord
validates :name, presence: true
validates :name, uniqueness: true
belongs_to :permission
# rubocop:disable Lint/DuplicateMethods
attr_accessor :content_html
# rubocop:enable Lint/DuplicateMethods
def url
"/#{name}"
end
def markup_style
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/calculated_penalty.rb | Ruby | mit | 191 | main | 242 | class CalculatedPenalty < ApplicationRecord
belongs_to :participant, class_name: 'Participant', foreign_key: 'participant_id', dependent: :destroy
belongs_to :deadline_type, class_name: 'DeadlineType', foreign_key: 'deadline_type_id'
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/feedback_response_map.rb | Ruby | mit | 191 | main | 3,946 | class FeedbackResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id'
belongs_to :review, class_name: 'Response', foreign_key: 'reviewed_object_id'
belongs_to :reviewer, class_name: 'AssignmentParticipant', dependent: :destroy
def assignment
review.map.assignme... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/assignment.rb | Ruby | mit | 191 | main | 27,376 | ###
####
#### We have spent a lot of time on refactoring this file, PLEASE consult with Expertiza development team before putting code in.
###
###
class Assignment < ApplicationRecord
require 'analytic/assignment_analytic'
include Scoring
include AssignmentAnalytic
include ReviewAssignment
include QuizAssign... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/quiz_assignment.rb | Ruby | mit | 191 | main | 3,204 | module QuizAssignment
# Returns a set of topics that can be used for taking the quiz.
# We choose the topics if one of its quiz submissions has been attempted the fewest times so far
def candidate_topics_for_quiz
return nil if sign_up_topics.empty? # This is not a topic assignment
contributor_set = Array... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/vm_tag_prompt_answer.rb | Ruby | mit | 191 | main | 227 | class VmTagPromptAnswer
def initialize(answer, tag_prompt, tag_dep)
@answer = answer
@tag_prompt = tag_prompt
@tag_dep = tag_dep
end
attr_reader :answer
attr_reader :tag_prompt
attr_reader :tag_dep
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/assignment_node.rb | Ruby | mit | 191 | main | 3,153 | # Node type for Assignments
# Author: ajbudlon
# Date: 7/18/2008
class AssignmentNode < Node
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'node_object_id'
belongs_to :node_object, class_name: 'Assignment', foreign_key: 'node_object_id'
# Returns the table in which to locate Assignments
def s... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/signed_up_team.rb | Ruby | mit | 191 | main | 4,988 | class SignedUpTeam < ApplicationRecord
belongs_to :topic, class_name: 'SignUpTopic'
belongs_to :team, class_name: 'Team'
# the below has been added to make is consistent with the database schema
validates :topic_id, :team_id, presence: true
scope :by_team_id, ->(team_id) { where('team_id = ?', team_id) }
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/global_survey_questionnaire.rb | Ruby | mit | 191 | main | 254 | class GlobalSurveyQuestionnaire < SurveyQuestionnaire
after_initialize :post_initialization
@print_name = 'Global Survey'
class << self
attr_reader :print_name
end
def post_initialization
self.display_type = 'Global Survey'
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/vm_question_response.rb | Ruby | mit | 191 | main | 8,427 | # This is a new model create by E1577 (heat map)
# represents each table in the view_team view.
# the important piece to note is that the @listofrows is a list of type VmQuestionResponse_Row, which represents a row of the heatgrid table.
class VmQuestionResponse
attr_reader :name, :rounds, :round, :questionnaire_typ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/system_settings.rb | Ruby | mit | 191 | main | 1,657 | class SystemSettings < ApplicationRecord
self.table_name = 'system_settings'
# rubocop:disable Lint/DuplicateMethods
attr_accessor :public_role, :default_markup_style
attr_accessor :site_default_page, :not_found_page, :permission_denied_page,
:session_expired_page
def public_role
@public... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/quiz_response_map.rb | Ruby | mit | 191 | main | 2,336 | class QuizResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Participant', foreign_key: 'reviewee_id', inverse_of: false
belongs_to :contributor, class_name: 'Participant', foreign_key: 'reviewee_id', inverse_of: false
belongs_to :quiz_questionnaire, class_name: 'QuizQuestionnaire', foreign_key: 'review... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/simicheck_webservice.rb | Ruby | mit | 191 | main | 10,341 | class SimiCheckWebService
@@api_key = PLAGIARISM_CHECKER_CONFIG['simicheck_api_key']
@@base_uri = 'https://www.simicheck.com/api'
############################################
# Comparison Operations
############################################
# Lists all comparisons for the SimiCheck account
# Parameters... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/badge.rb | Ruby | mit | 191 | main | 662 | class Badge < ApplicationRecord
has_many :assignment_badges, dependent: :destroy
has_many :assignments, through: :assignment_badges
has_many :awarded_badges, dependent: :destroy
has_many :participants, through: :awarded_badges
# adding validations for Badge table entries as part of project E1822
validates :... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/question_advice.rb | Ruby | mit | 191 | main | 859 | class QuestionAdvice < ApplicationRecord
# attr_accessible :score, :advice
belongs_to :question
# This method returns an array of fields present in question advice model
def self.export_fields(_options)
fields = []
QuestionAdvice.columns.each do |column|
fields.push(column.name)
end
field... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/self_review_response_map.rb | Ruby | mit | 191 | main | 906 | # E1600
# A new type called SelfReviewResponseMap was created for ResponseMap to handle self-reviews independent
class SelfReviewResponseMap < ResponseMap
belongs_to :reviewee, class_name: 'Team', foreign_key: 'reviewee_id'
belongs_to :assignment, class_name: 'Assignment', foreign_key: 'reviewed_object_id'
# Fin... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/collusion_cycle.rb | Ruby | mit | 191 | main | 4,109 | # new class created to handle code related to cycles between reviews
# This code was previously in AssignmentParticipant and is not being used anywhere yet
class CollusionCycle
# Cycle data structure
# Each edge of the cycle stores a participant and the score given by to the participant by the reviewer.
# Conside... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/table_header.rb | Ruby | mit | 191 | main | 460 | class TableHeader < QuestionnaireHeader
def complete(_count, _answer = nil)
html = '<br/><big><b>' + txt + '</b></big><br/>'
html += '<table class="general" style="border: 2; text-align: left; width: 100%">'
html.html_safe
end
def view_completed_question(_count, _answer)
html = '<br/><big><b>' + ... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/course_survey_response_map.rb | Ruby | mit | 191 | main | 455 | class CourseSurveyResponseMap < SurveyResponseMap
belongs_to :survey_deployment, foreign_key: 'reviewee_id'
belongs_to :course, foreign_key: 'reviewed_object_id'
belongs_to :reviewer, class_name: 'Participant', foreign_key: 'reviewer_id'
def questionnaire
Questionnaire.find_by(id: survey_deployment.questio... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/multiple_choice_checkbox.rb | Ruby | mit | 191 | main | 3,553 | class MultipleChoiceCheckbox < QuizQuestion
def edit
quiz_question_choices = QuizQuestionChoice.where(question_id: id)
html = '<tr><td>'
html += '<textarea cols="100" name="question[' + id.to_s + '][txt]" '
html += 'id="question_' + id.to_s + '_txt">' + txt + '</textarea>'
html += '</td></tr>'
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/user_pastebin.rb | Ruby | mit | 191 | main | 504 | class UserPastebin < ActiveRecord::Base
validates :user_id, uniqueness: { scope: :short_form }
@markdown_character = '\\'
def self.get_current_user_pastebin(user)
@user_pastebins = UserPastebin.where(user_id: user.id)
end
def self.get_current_user_pastebin_json(user)
@user_pastebins = get_current_u... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/participant.rb | Ruby | mit | 191 | main | 5,733 | class Participant < ApplicationRecord
include Scoring
include ParticipantsHelper
has_paper_trail
belongs_to :user
belongs_to :topic, class_name: 'SignUpTopic', inverse_of: false
belongs_to :assignment, foreign_key: 'parent_id', inverse_of: false
has_many :join_team_requests, dependent: :destroy
has_ma... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/view_translation_substitutor.rb | Ruby | mit | 191 | main | 2,704 | require 'yaml'
class ViewTranslationSubstitutor
BLACKLIST = "([a-zA-Z0-9\\._]+|[\"\\'])?".freeze
def substitute(locale)
stats = {}
locale.each { |dir_name, view_hash| stats[dir_name] = process_directory(dir_name, view_hash) }
File.open("translation_stats#{Time.now}.yml", 'w') { |file| file.write(stats... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/response_analytic.rb | Ruby | mit | 191 | main | 1,872 | require 'analytic/score_analytic'
module ResponseAnalytic
def num_questions
scores.count
end
#====== score =======#
def average_score
return question_score_list.inject(:+) / num_questions unless num_questions == 0
0
end
def max_question_score
question_score_list.max
end
def min_quest... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/score_analytic.rb | Ruby | mit | 191 | main | 261 | module ScoreAnalytic
def unique_character_count
comments.gsub(/[^0-9A-Za-z ]/, '').downcase.split(' ').uniq.count
end
def character_count
comments.bytesize
end
def word_count
comments.gsub(/[^0-9A-Za-z]/, ' ').split(' ').count
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/questionnaire_analytic.rb | Ruby | mit | 191 | main | 1,368 | require 'analytic/question_analytic'
module QuestionnaireAnalytic
# return all possible question types
def types
type_list = []
questions.each do |question|
type_list << question.type unless type_list.include?(question.type)
end
type_list
end
def num_questions
questions.count
end
... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/course_analytic.rb | Ruby | mit | 191 | main | 2,274 | require 'analytic/assignment_analytic'
module CourseAnalytic
#====== general statistics ======#
def num_participants
participants.count
end
def num_assignments
assignments.count
end
#===== number of assignment teams ====#
def total_num_assignment_teams
assignment_team_counts.inject(:+)
end... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/assignment_team_analytic.rb | Ruby | mit | 191 | main | 1,848 | # require 'analytic/response_analytic'
module AssignmentTeamAnalytic
#======= general ==========#
def num_participants
participants.count
end
def num_reviews
responses.count
end
#========== score ========#
def average_review_score
if num_reviews == 0
0
else
review_scores.inje... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/assignment_analytic.rb | Ruby | mit | 191 | main | 2,436 | require 'analytic/assignment_team_analytic'
module AssignmentAnalytic
#====== general statistics ======#
def num_participants
participants.count
end
def num_teams
teams.count
end
#==== number of team reviews ====#
def total_num_team_reviews
team_review_counts.inject(:+)
end
def average_... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/models/analytic/question_analytic.rb | Ruby | mit | 191 | main | 239 | module QuestionAnalytic
def unique_character_count
txt.gsub(/\s+/, '').downcase.split(//).uniq.length
end
def character_count
txt.bytesize
end
def word_count
txt.gsub(/[^0-9A-Za-z]/, ' ').split(' ').count
end
end |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/mailers/mail_worker.rb | Ruby | mit | 191 | main | 3,760 | require 'sidekiq'
class MailWorker
include Sidekiq::Worker
# ActionMailer in Rail 4 submits jobs in mailers queue instead of default queue. Rails 5 and onwards
# ActionMailer will submit mailer jobs to default queue. We need to remove the line below in that case!
sidekiq_options queue: 'mailers'
attr_accesso... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/mailers/mailer.rb | Ruby | mit | 191 | main | 3,664 | # frozen_string_literal: true
class Mailer < ActionMailer::Base
if Rails.env.development? || Rails.env.test?
default from: 'expertiza.mailer@gmail.com'
else
default from: 'expertiza.mailer@gmail.com'
end
def email_author_reviewers(subject, body, email)
Rails.env.development? || Rails.env.test? ? @... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/services/mcp_server_client.rb | Ruby | mit | 191 | main | 2,842 | # app/services/mcp_server_client.rb
require 'net/http'
require 'uri'
require 'json'
class MCPServerClient
def initialize(endpoint: Rails.configuration.x.mcp.endpoint, token: Rails.configuration.x.mcp.token, timeout: Rails.configuration.x.mcp.request_timeout)
@base_uri = URI(endpoint)
@token = token
@time... |
github | expertiza/expertiza | https://github.com/expertiza/expertiza | app/services/mcp_review_service.rb | Ruby | mit | 191 | main | 6,421 | # app/services/mcp_review_service.rb
class MCPReviewService
def initialize(mcp_client: MCPServerClient.new)
@mcp = mcp_client
end
# Sends all review/response to the MCP server for LLM evaluation.
# Accepts either a assignment_id (Expertiza) or a model instance.
# Returns MCP server response (parsed JSON... |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | Rakefile | Ruby | mit | 191 | master | 215 | require 'rake/testtask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the active_model_helper plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
end |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | dynamic_form.gemspec | Ruby | mit | 191 | master | 354 | Gem::Specification.new do |s|
s.name = 'dynamic_form'
s.version = '1.0.0'
s.author = 'David Heinemeier Hansson'
s.email = 'david@loudthinking.com'
s.summary = 'Deprecated dynamic form helpers: input, form, error_messages_for, error_messages_on'
s.add_dependency('rails', '>= 3.0.0')
s.files = Dir['lib/**... |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | test/dynamic_form_test.rb | Ruby | mit | 191 | master | 24,280 | require 'test_helper'
require 'action_view/template/handlers/erb'
class DynamicFormTest < ActionView::TestCase
tests ActionView::Helpers::DynamicForm
def form_for(*)
@output_buffer = super
end
silence_warnings do
class Post < Struct.new(:title, :author_name, :body, :secret, :written_on)
extend ... |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | test/dynamic_form_i18n_test.rb | Ruby | mit | 191 | master | 1,965 | require 'test_helper'
class DynamicFormI18nTest < Test::Unit::TestCase
include ActionView::Context
include ActionView::Helpers::DynamicForm
attr_reader :request
def setup
@object = stub :errors => stub(:count => 1, :full_messages => ['full_messages'])
@object.stubs :to_model => @object
@object.st... |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | test/test_helper.rb | Ruby | mit | 191 | master | 252 | require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_support/core_ext'
require 'action_view'
require 'action_controller'
require 'action_controller/test_case'
require 'active_model'
require 'action_view/helpers/dynamic_form' |
github | rails/dynamic_form | https://github.com/rails/dynamic_form | lib/action_view/helpers/dynamic_form.rb | Ruby | mit | 191 | master | 13,862 | require 'action_view/helpers'
require 'active_support/i18n'
require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/object/blank'
module ActionView
module Helpers
# The Active Record Helper makes it easier to create forms for records kept in instance variables. The most far-reaching is the ... |
github | public-law/asset_ram | https://github.com/public-law/asset_ram | asset_ram.gemspec | Ruby | mit | 191 | master | 1,381 | # frozen_string_literal: true
require_relative "lib/asset_ram/version"
Gem::Specification.new do |spec|
spec.name = "asset_ram"
spec.version = AssetRam::VERSION
spec.authors = ["Robert Shecter"]
spec.email = ["robert@public.law"]
spec.summary = "Improves Rails performance... |
github | public-law/asset_ram | https://github.com/public-law/asset_ram | spec/asset_ram_spec.rb | Ruby | mit | 191 | master | 4,781 | # frozen_string_literal: true
RSpec.describe AssetRam do
it "has a version number" do
expect(AssetRam::VERSION).not_to be nil
end
describe ".cache" do
let(:logger) { double("Logger", warn: nil) }
let(:counter) { SimpleCounter.new }
before do
stub_const("Rails", double("Rails", logger: log... |
github | public-law/asset_ram | https://github.com/public-law/asset_ram | spec/spec_helper.rb | Ruby | mit | 191 | master | 372 | # frozen_string_literal: true
require "asset_ram"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_... |
github | public-law/asset_ram | https://github.com/public-law/asset_ram | lib/asset_ram.rb | Ruby | mit | 191 | master | 2,217 | # frozen_string_literal: true
require_relative "asset_ram/version"
#
# Use in views to cache the asset path computation.
#
# Preferred usage (since v1.1.0):
#
# = AssetRam.cache { favicon_link_tag('favicon/favicon.ico', rel: 'icon') }
#
# The calculated asset paths are keyed by source file name and line number.
# T... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | Gemfile | Ruby | mit | 191 | main | 4,369 | source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '3.3.4'
# dotenv-rails must be on the top
gem 'dotenv-rails', '>= 3.1.3', groups: %i[development test]
gem 'inherited_resources', '2.0.0'
# Bundle Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.2... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/serializers/product_serializer.rb | Ruby | mit | 191 | main | 1,536 | # frozen_string_literal: true
# == Schema Information
#
# Table name: products
#
# id :bigint not null, primary key
# active :boolean
# bar_code :string
# extra_sku :string
# highlight ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/serializers/purchase_product_serializer.rb | Ruby | mit | 191 | main | 1,453 | # frozen_string_literal: true
# == Schema Information
#
# Table name: purchase_products
#
# id :bigint not null, primary key
# quantity :integer
# store_entrance :integer default("Sem_Loja")
# value :float
# created_at :datetime not null
# updated_at ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/serializers/sale_serializer.rb | Ruby | mit | 191 | main | 1,699 | # frozen_string_literal: true
# == Schema Information
#
# Table name: sales
#
# id :bigint not null, primary key
# disclosure :boolean
# discount :float
# exchange :boolean default(FALSE)
# online :boolean
# order_code ... |
github | Purple-Stock/open-erp | https://github.com/Purple-Stock/open-erp | app/presenters/bling_order_item_histories_presenter.rb | Ruby | mit | 191 | main | 507 | # frozen_string_literal: true
# BlingOrderItemHistoriesPresentable returns the hash the Chart js needs.
class BlingOrderItemHistoriesPresenter
attr_accessor :bling_order_item_collection
def initialize(bling_order_item_collection)
@bling_order_item_collection = bling_order_item_collection
end
def presenta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.