class MainWindow::EntityItemModel

def groupAndSubgroup

date = Date.parse(@ui.dateDateEdit.date.toString(Qt::ISODate))
dates = date.monday..date.monday + 6
v = Verificator.new(dates)
res = v.verify(:group_and_subgroup).map do |k, v|
  date = k[0]
  lecturer = Lecturer.where(id: k[1]).first
  number = k[2]
  if lecturer.stub
    nil
  else
    v.each{ |study| @study_table_models[date.cwday - 1].setColor(study.id Qt::red) }
    "#{date} | #{lecturer} ведёт несколько пар одновременно! Номер пары: #{number}"
  end
end

end

def on_verifyGroupAndSubgroup

@console.browser.clear
@console.show
@console.browser.append groupAndSubgroup

end

Public Class Methods

new(lambda, parent = nil) click to toggle source
Calls superclass method
# File lib/tmis/interface/mainwindow.rb, line 532
def initialize(lambda, parent = nil)
  super(parent)
  @get_entities = lambda
  @entities = @get_entities.()
  @size = @entities.size
end

Public Instance Methods

columnCount(parent = self) click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 553
def columnCount(parent = self)
  1
end
data(index, role = Qt::DisplayRole, data = nil) click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 561
def data(index, role = Qt::DisplayRole, data = nil)
  if role == Qt::DisplayRole && index.valid?
    @entities[index.row].to_s.to_v
  else
    Qt::Variant.new
  end
end
flags(index) click to toggle source
Calls superclass method
# File lib/tmis/interface/mainwindow.rb, line 569
def flags(index)
  if index.valid?
    Qt::ItemIsDragEnabled | super(index)
  else
    super(index)
  end
end
index(row, column, parent) click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 545
def index(row, column, parent)
  createIndex(row, column)
end
mimeData(indexes) click to toggle source
Calls superclass method
# File lib/tmis/interface/mainwindow.rb, line 577
def mimeData(indexes)
  entity = @entities[indexes.first.row]
  ba = Qt::ByteArray.new entity.id.to_s # Marshal.dump entity?
  mime_type = "application/#{entity.class.to_s.downcase}"
  mime_data = super indexes # для обхода ошибки сегментации Qt::MimeData создаётся с помощью родительского метода
  mime_data.setData(mime_type, ba)
  mime_data
end
parent(index) click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 549
def parent(index)
  Qt::ModelIndex.new()
end
refresh() click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 539
def refresh
  @entities = @get_entities.()
  @size = @entities.size
  emit layoutChanged()
end
rowCount(parent = self) click to toggle source
# File lib/tmis/interface/mainwindow.rb, line 557
def rowCount(parent = self)
  @size
end