RocketChat/Rocket.Chat

View on GitHub
apps/meteor/server/models/raw/LivechatRooms.ts

Summary

Maintainability
F
1 mo
Test Coverage

File LivechatRooms.ts has 2492 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import type {
    IOmnichannelRoom,
    RocketChatRecordDeleted,
    IOmnichannelRoomClosingInfo,
    DeepWritable,
Severity: Major
Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 6 days to fix

    LivechatRoomsRaw has 117 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILivechatRoomsModel {
        constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<IOmnichannelRoom>>) {
            super(db, 'room', trash);
        }
    
    
    Severity: Major
    Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 days to fix

      Function findAllNumberOfTransferredRooms has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          findAllNumberOfTransferredRooms({
              start,
              end,
              departmentId,
              options = {},
      Severity: Major
      Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 4 hrs to fix

        Function getQueueMetrics has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getQueueMetrics({
                departmentId,
                agentId,
                includeOfflineAgents,
                options = {},
        Severity: Major
        Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 3 hrs to fix

          Function getAnalyticsMetricsBetweenDateWithMessages has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getAnalyticsMetricsBetweenDateWithMessages(
                  t: string,
                  date: { gte: Date; lt: Date },
                  { departmentId }: { departmentId?: string } = {},
                  extraQuery: Document = {},
          Severity: Major
          Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

            Function getAnalyticsBetweenDate has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getAnalyticsBetweenDate(date: { gte: Date; lt: Date }, { departmentId }: { departmentId?: string } = {}) {
                    return this.col.aggregate<Pick<IOmnichannelRoom, 'ts' | 'departmentId' | 'open' | 'servedBy' | 'metrics' | 'msgs' | 'onHold'>>(
                        [
                            {
                                $match: {
            Severity: Major
            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

              Function findRoomsByVisitorIdAndMessageWithCriteria has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  findRoomsByVisitorIdAndMessageWithCriteria({
                      visitorId,
                      searchText,
                      open,
                      served,
              Severity: Major
              Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                Function getMACStatisticsBetweenDates has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async getMACStatisticsBetweenDates(start: Date, end: Date): Promise<MACStats[]> {
                        return this.col
                            .aggregate<MACStats>([
                                {
                                    $match: {
                Severity: Major
                Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                  Function findPercentageOfAbandonedRooms has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      async findPercentageOfAbandonedRooms({
                          start,
                          end,
                          departmentId,
                          onlyCount = false,
                  Severity: Major
                  Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                    Function getMACStatisticsForPeriod has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        async getMACStatisticsForPeriod(period: string): Promise<MACStats[]> {
                            return this.col
                                .aggregate<MACStats>([
                                    {
                                        $match: {
                    Severity: Major
                    Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                      Function findRoomsWithCriteria has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                          findRoomsWithCriteria({
                              agents,
                              roomName,
                              departmentId,
                              open,
                      Severity: Minor
                      Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function findRoomsWithCriteria has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          findRoomsWithCriteria({
                              agents,
                              roomName,
                              departmentId,
                              open,
                      Severity: Major
                      Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 2 hrs to fix

                        Function findAllAverageServiceTimeByAgents has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            findAllAverageServiceTimeByAgents({
                                start,
                                end,
                                onlyCount = false,
                                options = {},
                        Severity: Minor
                        Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                          Function saveRoomById has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              async saveRoomById({
                                  _id,
                                  topic,
                                  tags,
                                  livechatData,
                          Severity: Minor
                          Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                            Function findAllAverageOfServiceTime has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                findAllAverageOfServiceTime({
                                    start,
                                    end,
                                    departmentId,
                                    onlyCount = false,
                            Severity: Minor
                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                              Function findAllAverageWaitingTime has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  findAllAverageWaitingTime({
                                      start,
                                      end,
                                      departmentId,
                                      onlyCount = false,
                              Severity: Minor
                              Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                Function countAllClosedChatsByDepartmentBetweenDate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    countAllClosedChatsByDepartmentBetweenDate({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                        const match: Document = {
                                            $match: {
                                                t: 'l',
                                                open: { $exists: false },
                                Severity: Minor
                                Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                  Function countAllOpenChatsByDepartmentBetweenDate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      countAllOpenChatsByDepartmentBetweenDate({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                          const match: Document = {
                                              $match: {
                                                  t: 'l',
                                                  open: true,
                                  Severity: Minor
                                  Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                    Function findAllNumberOfAbandonedRooms has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        async findAllNumberOfAbandonedRooms({
                                            start,
                                            end,
                                            departmentId,
                                            onlyCount = false,
                                    Severity: Minor
                                    Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                      Function findAllAverageOfChatDurationTime has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          findAllAverageOfChatDurationTime({
                                              start,
                                              end,
                                              departmentId,
                                              onlyCount = false,
                                      Severity: Minor
                                      Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                        Function findAllServiceTime has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            findAllServiceTime({
                                                start,
                                                end,
                                                departmentId,
                                                onlyCount = false,
                                        Severity: Minor
                                        Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                          Function calculateDurationTimingsBetweenDates has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              calculateDurationTimingsBetweenDates({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                  const match: Document = {
                                                      $match: {
                                                          't': 'l',
                                                          'ts': { $gte: new Date(start), $lte: new Date(end) },
                                          Severity: Minor
                                          Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                            Function findAvailableSources has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                findAvailableSources() {
                                                    return this.col.aggregate([
                                                        {
                                                            $group: {
                                                                _id: 0,
                                            Severity: Minor
                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                              Function findAllRooms has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                  findAllRooms({
                                                      start,
                                                      end,
                                                      answered,
                                                      departmentId,
                                              Severity: Minor
                                              Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                Function calculateResponseTimingsBetweenDates has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    calculateResponseTimingsBetweenDates({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                        const match: Document = {
                                                            $match: {
                                                                t: 'l',
                                                                ts: { $gte: new Date(start), $lte: new Date(end) },
                                                Severity: Minor
                                                Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                  Function calculateReactionTimingsBetweenDates has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                      calculateReactionTimingsBetweenDates({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                          const match: Document = {
                                                              $match: {
                                                                  t: 'l',
                                                                  ts: { $gte: new Date(start), $lte: new Date(end) },
                                                  Severity: Minor
                                                  Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                    Function findAllServiceTimeByAgent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                        findAllServiceTimeByAgent({
                                                            start,
                                                            end,
                                                            onlyCount = false,
                                                            options = {},
                                                    Severity: Minor
                                                    Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                      Function saveAnalyticsDataByRoomId has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                          saveAnalyticsDataByRoomId(room: IOmnichannelRoom, message: IMessage, analyticsData: Record<string, string | number | Date>) {
                                                              const update: DeepWritable<UpdateFilter<IOmnichannelRoom>> = {
                                                                  $set: {
                                                                      ...(analyticsData && {
                                                                          'metrics.response.avg': analyticsData.avgResponseTime,
                                                      Severity: Minor
                                                      Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                        Function saveRoomById has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                        Open

                                                            async saveRoomById({
                                                                _id,
                                                                topic,
                                                                tags,
                                                                livechatData,
                                                        Severity: Minor
                                                        Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                        Cognitive Complexity

                                                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                        A method's cognitive complexity is based on a few simple rules:

                                                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                        • Code is considered more complex for each "break in the linear flow of the code"
                                                        • Code is considered more complex when "flow breaking structures are nested"

                                                        Further reading

                                                        Function modelIndexes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                            protected modelIndexes(): IndexDescription[] {
                                                                return [
                                                                    { key: { open: 1 }, sparse: true },
                                                                    { key: { departmentId: 1 }, sparse: true },
                                                                    { key: { 'metrics.chatDuration': 1 }, sparse: true },
                                                        Severity: Minor
                                                        Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                          Function countAllOpenChatsByAgentBetweenDate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                              countAllOpenChatsByAgentBetweenDate({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                                  const match: Document = {
                                                                      $match: {
                                                                          't': 'l',
                                                                          'servedBy.username': { $exists: true },
                                                          Severity: Minor
                                                          Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 1 hr to fix

                                                            Function findAllRooms has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                findAllRooms({
                                                                    start,
                                                                    end,
                                                                    answered,
                                                                    departmentId,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 55 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function getQueueMetrics has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                getQueueMetrics({
                                                                    departmentId,
                                                                    agentId,
                                                                    includeOfflineAgents,
                                                                    options = {},
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 45 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findPercentageOfAbandonedRooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                async findPercentageOfAbandonedRooms({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findAllNumberOfAbandonedRooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                async findAllNumberOfAbandonedRooms({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findAllAverageWaitingTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                findAllAverageWaitingTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findAllAverageOfChatDurationTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                findAllAverageOfChatDurationTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findAllServiceTime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                findAllServiceTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function saveAnalyticsDataByRoomId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                saveAnalyticsDataByRoomId(room: IOmnichannelRoom, message: IMessage, analyticsData: Record<string, string | number | Date>) {
                                                                    const update: DeepWritable<UpdateFilter<IOmnichannelRoom>> = {
                                                                        $set: {
                                                                            ...(analyticsData && {
                                                                                'metrics.response.avg': analyticsData.avgResponseTime,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Function findRoomsByVisitorIdAndMessageWithCriteria has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                            Open

                                                                findRoomsByVisitorIdAndMessageWithCriteria({
                                                                    visitorId,
                                                                    searchText,
                                                                    open,
                                                                    served,
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts - About 25 mins to fix

                                                            Cognitive Complexity

                                                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                            A method's cognitive complexity is based on a few simple rules:

                                                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                            • Code is considered more complex for each "break in the linear flow of the code"
                                                            • Code is considered more complex when "flow breaking structures are nested"

                                                            Further reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                calculateResponseTimingsBetweenDates({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                                    const match: Document = {
                                                                        $match: {
                                                                            t: 'l',
                                                                            ts: { $gte: new Date(start), $lte: new Date(end) },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 day to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 949..990

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 307.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                calculateReactionTimingsBetweenDates({ start, end, departmentId }: { start: Date; end: Date; departmentId?: string }) {
                                                                    const match: Document = {
                                                                        $match: {
                                                                            t: 'l',
                                                                            ts: { $gte: new Date(start), $lte: new Date(end) },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 day to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 906..947

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 307.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                async findPercentageOfAbandonedRooms({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 193..247
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 322..376
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 378..434
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 493..547
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1036..1093

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                findAllAverageOfServiceTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 193..247
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 249..320
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 322..376
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 378..434
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 493..547

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                findAllAverageOfChatDurationTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 193..247
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 249..320
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 378..434
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 493..547
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1036..1093

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                async findAllNumberOfAbandonedRooms({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 249..320
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 322..376
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 378..434
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 493..547
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1036..1093

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                findAllServiceTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 193..247
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 249..320
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 322..376
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 378..434
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1036..1093

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 6 locations. Consider refactoring.
                                                            Open

                                                                findAllAverageWaitingTime({
                                                                    start,
                                                                    end,
                                                                    departmentId,
                                                                    onlyCount = false,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 5 other locations - About 4 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 193..247
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 249..320
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 322..376
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 493..547
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1036..1093

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 115.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findAllAverageServiceTimeByAgents({
                                                                    start,
                                                                    end,
                                                                    onlyCount = false,
                                                                    options = {},
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 3 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1310..1360

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 103.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findAllServiceTimeByAgent({
                                                                    start,
                                                                    end,
                                                                    onlyCount = false,
                                                                    options = {},
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 3 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1362..1417

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 103.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findByVisitorId(visitorId: string, options: FindOptions<IOmnichannelRoom>, extraQuery: Filter<IOmnichannelRoom> = {}) {
                                                                    const query: Filter<IOmnichannelRoom> = {
                                                                        't': 'l',
                                                                        'v._id': visitorId,
                                                                        ...extraQuery,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1104..1111

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 89.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findPaginatedByVisitorId(visitorId: string, options: FindOptions<IOmnichannelRoom>, extraQuery: Filter<IOmnichannelRoom> = {}) {
                                                                    const query: Filter<IOmnichannelRoom> = {
                                                                        't': 'l',
                                                                        'v._id': visitorId,
                                                                        ...extraQuery,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1095..1102

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 89.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    if (createdAt) {
                                                                        query.ts = {};
                                                                        if (createdAt.start) {
                                                                            query.ts.$gte = new Date(createdAt.start);
                                                                        }
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1255..1263

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 87.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    if (closedAt) {
                                                                        query.closedAt = {};
                                                                        if (closedAt.start) {
                                                                            query.closedAt.$gte = new Date(closedAt.start);
                                                                        }
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1246..1254

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 87.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getConversationsByTags(
                                                                    _start: Date,
                                                                    _end: Date,
                                                                    _sort: Record<string, 1 | -1>,
                                                                    _extraQuery: Filter<IOmnichannelRoom>,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2677..2684
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2695..2702

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 75.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getConversationsByAgents(
                                                                    _start: Date,
                                                                    _end: Date,
                                                                    _sort: Record<string, 1 | -1>,
                                                                    _extraQuery: Filter<IOmnichannelRoom>,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2677..2684
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2686..2693

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 75.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getConversationsByDepartment(
                                                                    _start: Date,
                                                                    _end: Date,
                                                                    _sort: Record<string, 1 | -1>,
                                                                    _extraQuery: Filter<IOmnichannelRoom>,
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 2 hrs to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2686..2693
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2695..2702

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 75.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                            {
                                                                                $group: {
                                                                                    _id: null,
                                                                                    sources: {
                                                                                        $push: {
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2548..2569

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 74.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                            {
                                                                                $group: {
                                                                                    _id: null,
                                                                                    sources: {
                                                                                        $push: {
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2486..2507

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 74.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                    const project = {
                                                                        $project: {
                                                                            _id: { $ifNull: ['$_id.departmentId', null] },
                                                                            averageChatDurationTimeInSeconds: {
                                                                                $ceil: { $cond: [{ $eq: ['$rooms', 0] }, 0, { $divide: ['$chatsDuration', '$rooms'] }] },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 408..417
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1069..1076

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 67.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                    const project = {
                                                                        $project: {
                                                                            _id: { $ifNull: ['$_id.departmentId', null] },
                                                                            averageServiceTimeInSeconds: {
                                                                                $ceil: { $cond: [{ $eq: ['$rooms', 0] }, 0, { $divide: ['$allServiceTime', '$rooms'] }] },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 352..359
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 408..417

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 67.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                    const project = {
                                                                        $project: {
                                                                            _id: { $ifNull: ['$_id.departmentId', null] },
                                                                            averageWaitingTimeInSeconds: {
                                                                                $ceil: {
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 352..359
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1069..1076

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 67.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                                $match: {
                                                                                    t,
                                                                                    ts: {
                                                                                        $gte: new Date(date.gte), // ISO Date, ts >= date.gte
                                                                                        $lt: new Date(date.lt), // ISODate, ts < date.lt
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2090..2098

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 67.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const query: Filter<IOmnichannelRoom> = {
                                                                        t,
                                                                        ts: {
                                                                            $gte: new Date(date.gte), // ISO Date, ts >= date.gte
                                                                            $lt: new Date(date.lt), // ISODate, ts < date.lt
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2115..2123

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 67.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                changeDepartmentIdByRoomId(roomId: string, departmentId: string) {
                                                                    const query: Filter<IOmnichannelRoom> = {
                                                                        _id: roomId,
                                                                        t: 'l',
                                                                    };
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2325..2337

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 65.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                saveCRMDataByRoomId(roomId: string, crmData: unknown) {
                                                                    const query: Filter<IOmnichannelRoom> = {
                                                                        _id: roomId,
                                                                        t: 'l',
                                                                    };
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2311..2323

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 65.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const match: Document = {
                                                                        $match: {
                                                                            't': 'l',
                                                                            'servedBy._id': { $exists: true },
                                                                            'metrics.serviceTimeDuration': { $exists: true },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1321..1331

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 63.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const match: Document = {
                                                                        $match: {
                                                                            't': 'l',
                                                                            'servedBy._id': { $exists: true },
                                                                            'metrics.serviceTimeDuration': { $exists: true },
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1373..1383

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 63.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const group: Document = {
                                                                        $group: {
                                                                            _id: {
                                                                                _id: null,
                                                                                departmentId: '$departmentId',
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 342..351

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 58.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const group: Document = {
                                                                        $group: {
                                                                            _id: {
                                                                                _id: null,
                                                                                departmentId: '$departmentId',
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 1 hr to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 398..407

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 58.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                getConversationsByStatus(_start: Date, _end: Date, _extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> {
                                                                    throw new Error('Method not implemented.');
                                                                }
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 55 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2669..2671

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 54.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                getConversationsBySource(_start: Date, _end: Date, _extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> {
                                                                    throw new Error('Method not implemented.');
                                                                }
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 55 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2673..2675

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 54.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getTotalConversationsWithoutDepartmentBetweenDates(_start: Date, _end: Date, _extraQuery: Filter<IOmnichannelRoom>): Promise<number> {
                                                                    throw new Error('Method not implemented.');
                                                                }
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2704..2706
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2708..2710

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 52.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getTotalConversationsWithoutAgentsBetweenDate(_start: Date, _end: Date, _extraQuery: Filter<IOmnichannelRoom>): Promise<number> {
                                                                    throw new Error('Method not implemented.');
                                                                }
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2704..2706
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2712..2714

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 52.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 3 locations. Consider refactoring.
                                                            Open

                                                                getConversationsWithoutTagsBetweenDate(_start: Date, _end: Date, _extraQuery: Filter<IOmnichannelRoom>): Promise<number> {
                                                                    throw new Error('Method not implemented.');
                                                                }
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 2 other locations - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2708..2710
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2712..2714

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 52.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const group = {
                                                                        $group: {
                                                                            _id: { _id: '$servedBy._id', username: '$servedBy.username' },
                                                                            chats: { $sum: 1 },
                                                                            serviceTimeDuration: { $sum: '$metrics.serviceTimeDuration' },
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1384..1390

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 52.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                    const group = {
                                                                        $group: {
                                                                            _id: { _id: '$servedBy._id', username: '$servedBy.username' },
                                                                            chats: { $sum: 1 },
                                                                            serviceTimeDuration: { $sum: '$metrics.serviceTimeDuration' },
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1332..1338

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 52.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Identical blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                            if (value) {
                                                                                setData[`livechatData.${key}`] = value;
                                                                            } else {
                                                                                unsetData[`livechatData.${key}`] = 1;
                                                                            }
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 50 mins to fix
                                                            apps/meteor/server/models/raw/LivechatVisitors.ts on lines 327..331

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 51.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                            {
                                                                                $group: {
                                                                                    _id: {
                                                                                        source: {
                                                                                            $ifNull: ['$source.alias', '$source.type'],
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 45 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2533..2547

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 50.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                            {
                                                                                $group: {
                                                                                    _id: {
                                                                                        source: {
                                                                                            $ifNull: ['$source.alias', '$source.type'],
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 45 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2471..2485

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 50.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                            Open

                                                                setVisitorInactivityInSecondsById(roomId: string, visitorInactivity: number) {
                                                                    const query = {
                                                                        _id: roomId,
                                                                    };
                                                                    const update = {
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 3 other locations - About 40 mins to fix
                                                            apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 212..223
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2386..2397
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2448..2460

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                            Open

                                                                markVisitorActiveForPeriod(rid: string, period: string): Promise<UpdateResult> {
                                                                    const query = {
                                                                        _id: rid,
                                                                    };
                                                            
                                                            
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 3 other locations - About 40 mins to fix
                                                            apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 212..223
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2386..2397
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2399..2410

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 4 locations. Consider refactoring.
                                                            Open

                                                                setVisitorLastMessageTimestampByRoomId(roomId: string, lastMessageTs: Date) {
                                                                    const query = {
                                                                        _id: roomId,
                                                                    };
                                                                    const update = {
                                                            Severity: Major
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 3 other locations - About 40 mins to fix
                                                            apps/meteor/ee/server/models/raw/LivechatRooms.ts on lines 212..223
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2399..2410
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 2448..2460

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                setDepartmentByRoomId(roomId: string, departmentId: string) {
                                                                    return this.updateOne({ _id: roomId }, { $set: { departmentId } });
                                                                }
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 40 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1534..1543

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                setPdfTranscriptFileIdById(rid: string, fileId: string) {
                                                                    return this.updateOne(
                                                                        {
                                                                            _id: rid,
                                                                        },
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 40 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1419..1421

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                unsetAutoTransferOngoingById(roomId: string) {
                                                                    const query = {
                                                                        _id: roomId,
                                                                    };
                                                                    const update = {
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 40 mins to fix
                                                            apps/meteor/server/models/raw/LivechatDepartment.ts on lines 202..214

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 48.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findOpenByVisitorTokenAndDepartmentId(
                                                                    visitorToken: string,
                                                                    departmentId: string,
                                                                    options: FindOptions<IOmnichannelRoom> = {},
                                                                    extraQuery: Filter<IOmnichannelRoom> = {},
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 35 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1936..1950

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 47.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            Similar blocks of code found in 2 locations. Consider refactoring.
                                                            Open

                                                                findByVisitorIdAndAgentId(
                                                                    visitorId?: string,
                                                                    agentId?: string,
                                                                    options: FindOptions<IOmnichannelRoom> = {},
                                                                    extraQuery: Filter<IOmnichannelRoom> = {},
                                                            Severity: Minor
                                                            Found in apps/meteor/server/models/raw/LivechatRooms.ts and 1 other location - About 35 mins to fix
                                                            apps/meteor/server/models/raw/LivechatRooms.ts on lines 1909..1924

                                                            Duplicated Code

                                                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                            Tuning

                                                            This issue has a mass of 47.

                                                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                            Refactorings

                                                            Further Reading

                                                            There are no issues that match your filters.

                                                            Category
                                                            Status