class Searching::GuideProgress::SolvedAssignmentsPercentage

Public Instance Methods

pipeline() click to toggle source
# File lib/mumuki/classroom/models/searching/guide_progress.rb, line 66
def pipeline
  [
    {
      '$addFields': {
        'stats.solved_percentage': {
          '$multiply': [
            {
              '$divide': [
                {'$sum': %w($stats.passed $stats.passed_with_warnings)},
                {'$sum': %w($stats.passed $stats.passed_with_warnings $stats.failed)}
              ]
            },
            100
          ]
        }
      }
    },
    {
      '$match': {'stats.solved_percentage': current_query_operand }
    }
  ]
end